From 8f68fa12e4fd686a456ca6d95e99bee5d350f750 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 27 Dec 2022 20:13:50 +0100 Subject: [PATCH] feat: custom emoji font in editor --- components/publish/PublishWidget.vue | 15 ++-- composables/content-parse.ts | 8 +- composables/emojis.ts | 1 + composables/tiptap.ts | 3 +- composables/tiptap/custom-emoji.ts | 112 +++++++++++++++++++++++++++ composables/tiptap/emoji.ts | 93 ++++++---------------- styles/global.css | 7 +- 7 files changed, 153 insertions(+), 86 deletions(-) create mode 100644 composables/tiptap/custom-emoji.ts diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue index 635f9152..484d8041 100644 --- a/components/publish/PublishWidget.vue +++ b/components/publish/PublishWidget.vue @@ -65,11 +65,11 @@ async function handlePaste(evt: ClipboardEvent) { await uploadAttachments(Array.from(files)) } -function insertText(text: string) { - editor.value?.chain().insertContent(text).focus().run() +function insertEmoji(name: string) { + editor.value?.chain().focus().insertEmoji(name).run() } -function insertEmoji(image: any) { - editor.value?.chain().focus().setEmoji(image).run() +function insertCustomEmoji(image: any) { + editor.value?.chain().focus().insertCustomEmoji(image).run() } async function pickAttachments() { @@ -196,7 +196,7 @@ defineExpose({
-
+
@@ -280,7 +280,10 @@ defineExpose({ v-if="shouldExpanded" flex="~ gap-2 1" m="l--1" pt-2 justify="between" max-full border="t base" > - +