enh: shortcode emojis

This commit is contained in:
Timothy Jaeryang Baek
2026-03-29 19:01:50 -05:00
parent 2388dd7dc3
commit 2040095050
4 changed files with 155 additions and 1 deletions
@@ -622,6 +622,25 @@
}
}
})
},
{
char: ':',
allowSpaces: false,
command: ({ editor, range, props }) => {
// Convert the Unicode hex codepoint (e.g. "1F44B") to the actual emoji character (👋)
const codepoint = props.id;
const emoji = String.fromCodePoint(parseInt(codepoint, 16));
editor.chain().focus().deleteRange(range).insertContent(emoji).run();
},
render: getSuggestionRenderer(CommandSuggestionList, {
i18n,
onSelect: (e) => {
document.getElementById('chat-input')?.focus();
},
insertTextHandler: insertTextAtCursor,
onUpload: () => {}
})
}
];
loaded = true;