Skip to content

Flow builder strips U+FE0F from emoji (keycaps show as boxes; text likely saved without FE0F) — @tiptap/extension-emoji gitHubEmojis #1686

Closed

Description

@andreus1610

Version: 1.17.1 self-hosted (same editor setup in main, 16adce6)

What happens
In the flow builder, emoji that need the variation selector U+FE0F lose it when a message is shown in the editor:

  • keycaps turn into a digit plus an empty box: 1️⃣ (U+0031 U+FE0F U+20E3) is shown as 1⃣ (U+0031 U+20E3);
  • ❤️ ⤵️ ✔️ ⬇️ ⚠️ ➡️ are shown in text presentation (❤ ⤵ ✔ ⬇ ⚠ ➡).

The text stored in FlowVersion is correct (checked byte by byte) and is sent correctly to Instagram. Just opening a flow does not change the stored text.

Why
plain-text-tiptap-editor.tsx (line 163) and tiptap-editor.tsx (line 92) configure @tiptap/extension-emoji with emojis: gitHubEmojis. In that list these emoji are stored without U+FE0F (for example {emoji: "1⃣", name: "one", fallbackImage: ".../0031-fe0f-20e3.png"}). On load the extension matches the full sequence, strips FE0F to look it up, and replaces it with an emoji node that renders the list's character.

Likely data loss on save
The editor saves with editor.getText({ blockSeparator: "\n" }) (lines 219 / 119), and the emoji node's renderText returns the list's character. So editing any part of a message in the builder should save every such emoji without FE0F. We have read this in the code but not reproduced it yet. The message sent to the contact would then carry the stripped characters too.

Related upstream issue: ueberdosis/tiptap#5934 ("Emojis not returned correctly with getText").

Repro

  1. Create a flow via the API whose text is 1️⃣ ❤️ ⚠️ (with U+FE0F).
  2. Open it in the builder: the keycap shows as 1⃣ with a box, the others in text style.
  3. (Expected loss) type a space in that message and save: FlowVersion then holds 1⃣ ❤ ⚠ without U+FE0F.

Suggested fix
Pass an emoji list with fully-qualified sequences (the code points are already in each item's fallbackImage file name, e.g. 0031-fe0f-20e3), or override the emoji node's renderText to return the fully-qualified sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions