Skip to content

Commit c4d0655

Browse files
authored
feat(editor): emoji integration (#171)
1 parent 60fab63 commit c4d0655

File tree

8 files changed

+11808
-3
lines changed

8 files changed

+11808
-3
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"@octokit/types": "^16.0.0",
6767
"@release-it/conventional-changelog": "^10.0.3",
6868
"@tailwindcss/typography": "^0.5.19",
69+
"@tiptap/extension-emoji": "^3.13.0",
6970
"@types/js-yaml": "^4.0.9",
7071
"@unhead/vue": "^2.0.19",
7172
"@unpic/vue": "^1.0.0",

pnpm-lock.yaml

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/src/components/content/ContentEditorTipTap.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<script setup lang="ts">
22
import type { DropdownMenuItem } from '@nuxt/ui/runtime/components/DropdownMenu.vue.d.ts'
33
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'
55
import type { PropType } from 'vue'
66
import type { Editor, JSONContent } from '@tiptap/vue-3'
77
import type { MDCRoot, Toc } from '@nuxtjs/mdc'
88
import { generateToc } from '@nuxtjs/mdc/dist/runtime/parser/toc'
99
import type { DraftItem, DatabasePageItem } from '../../types'
1010
import type { MarkdownRoot } from '@nuxt/content'
1111
import type { EditorCustomHandlers } from '@nuxt/ui'
12+
import type { EditorEmojiMenuItem } from '@nuxt/ui/runtime/components/EditorEmojiMenu.vue.d.ts'
1213
import { ref, watch, computed } from 'vue'
1314
import { titleCase } from 'scule'
1415
import { useI18n } from 'vue-i18n'
@@ -152,6 +153,10 @@ const dragHandleItems = (editor: Editor): DropdownMenuItem[][] => {
152153
}
153154
154155
const toolbarItems = computed(() => getStandardToolbarItems(t))
156+
157+
const emojiItems: EditorEmojiMenuItem[] = gitHubEmojis.filter(
158+
emoji => !emoji.name.startsWith('regional_indicator_'),
159+
)
155160
</script>
156161

157162
<template>
@@ -184,6 +189,7 @@ const toolbarItems = computed(() => getStandardToolbarItems(t))
184189
InlineElement,
185190
Slot,
186191
CodeBlock,
192+
Emoji,
187193
]"
188194
:placeholder="$t('studio.tiptap.editor.placeholder')"
189195
>
@@ -226,6 +232,11 @@ const toolbarItems = computed(() => getStandardToolbarItems(t))
226232
:editor="editor"
227233
:items="suggestionItems"
228234
/>
235+
236+
<UEditorEmojiMenu
237+
:editor="editor"
238+
:items="emojiItems"
239+
/>
229240
</UEditor>
230241
</div>
231242
</template>

src/app/src/shared.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
export { VirtualMediaCollectionName } from './utils/media'
22
export type { MarkdownParsingOptions } from './types/content'
3+
4+
// Temporary export for remark emoji plugin
5+
export * from './utils/emoji'

0 commit comments

Comments
 (0)