|
1 | 1 | <script setup lang="ts"> |
2 | 2 | import type { DropdownMenuItem } from '@nuxt/ui/runtime/components/DropdownMenu.vue.d.ts' |
3 | 3 | import type { EditorSuggestionMenuItem } from '@nuxt/ui/runtime/components/EditorSuggestionMenu.vue.d.ts' |
4 | | -// import { Emoji, gitHubEmojis } from '@tiptap/extension-emoji' |
| 4 | +import { Emoji, gitHubEmojis } from '@tiptap/extension-emoji' |
5 | 5 | import type { PropType } from 'vue' |
6 | 6 | import type { Editor, JSONContent } from '@tiptap/vue-3' |
7 | 7 | import type { MDCRoot, Toc } from '@nuxtjs/mdc' |
8 | 8 | import { generateToc } from '@nuxtjs/mdc/dist/runtime/parser/toc' |
9 | 9 | import type { DraftItem, DatabasePageItem } from '../../types' |
10 | 10 | import type { MarkdownRoot } from '@nuxt/content' |
11 | 11 | import type { EditorCustomHandlers } from '@nuxt/ui' |
| 12 | +import type { EditorEmojiMenuItem } from '@nuxt/ui/runtime/components/EditorEmojiMenu.vue.d.ts' |
12 | 13 | import { ref, watch, computed } from 'vue' |
13 | 14 | import { titleCase } from 'scule' |
14 | 15 | import { useI18n } from 'vue-i18n' |
@@ -152,6 +153,10 @@ const dragHandleItems = (editor: Editor): DropdownMenuItem[][] => { |
152 | 153 | } |
153 | 154 |
|
154 | 155 | const toolbarItems = computed(() => getStandardToolbarItems(t)) |
| 156 | +
|
| 157 | +const emojiItems: EditorEmojiMenuItem[] = gitHubEmojis.filter( |
| 158 | + emoji => !emoji.name.startsWith('regional_indicator_'), |
| 159 | +) |
155 | 160 | </script> |
156 | 161 |
|
157 | 162 | <template> |
@@ -184,6 +189,7 @@ const toolbarItems = computed(() => getStandardToolbarItems(t)) |
184 | 189 | InlineElement, |
185 | 190 | Slot, |
186 | 191 | CodeBlock, |
| 192 | + Emoji, |
187 | 193 | ]" |
188 | 194 | :placeholder="$t('studio.tiptap.editor.placeholder')" |
189 | 195 | > |
@@ -226,6 +232,11 @@ const toolbarItems = computed(() => getStandardToolbarItems(t)) |
226 | 232 | :editor="editor" |
227 | 233 | :items="suggestionItems" |
228 | 234 | /> |
| 235 | + |
| 236 | + <UEditorEmojiMenu |
| 237 | + :editor="editor" |
| 238 | + :items="emojiItems" |
| 239 | + /> |
229 | 240 | </UEditor> |
230 | 241 | </div> |
231 | 242 | </template> |
0 commit comments