enh: shortcode emojis
This commit is contained in:
1 parent
2388dd7dc3
commit
2040095050
4 files changed
+155
-1
No files matched your search
@@ -407,7 +407,7 @@
|
||||
let command = '';
|
||||
export let showCommands = false;
|
||||
$: showCommands =
|
||||
['/', '#', '@', '$'].includes(command?.charAt(0)) || '\\#' === command?.slice(0, 2);
|
||||
['/', '#', '@', '$', ':'].includes(command?.charAt(0)) || '\\#' === command?.slice(0, 2);
|
||||
let suggestions = null;
|
||||
|
||||
let showTools = false;
|
||||
@@ -1030,6 +1030,25 @@
|
||||
document.getElementById('chat-input')?.focus();
|
||||
},
|
||||
|
||||
insertTextHandler: insertTextAtCursor,
|
||||
onUpload: () => {}
|
||||
})
|
||||
},
|
||||
{
|
||||
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: () => {}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user