ueberdosis/tiptap-php

Support for the Emoji Extension?

Opened this issue · 1 comments

bribar commented

Is there any support to parse json to html for emoji nodes? Currently it just strips the emoji.

Here's a work around I came up with for my need...but would be nice if the library included something similar. I used this library for reference https://github.com/elvanto/litemoji/tree/master

$editor->descendants(function (&$node) {
       // Skip if not emoji
       if ($node->type !== 'emoji') {
             return;
       }
       // Change node to text and convert emoji shortcode
       $node->type = 'text';
       $node->text = LitEmoji::encodeUnicode(':'.$node->attrs->name.':');
});

Alternatively, one could extend the Node class similar to the Mention extension included in the Tiptap library for emojis.