feat: render custom server emojis on editor (#579)

This commit is contained in:
Joaquín Sánchez 2022-12-27 19:38:57 +01:00 committed by GitHub
parent 847e64ef6d
commit 4d21d27f94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 144 additions and 9 deletions

View file

@ -4,6 +4,7 @@ import { updateCustomEmojis } from '~/composables/emojis'
const emit = defineEmits<{
(e: 'select', code: string): void
(e: 'selectCustom', image: any): void
}>()
const el = $ref<HTMLElement>()
@ -22,8 +23,10 @@ async function openEmojiPicker() {
const { Picker } = await import('emoji-mart')
picker = new Picker({
data: () => promise,
onEmojiSelect(e: any) {
emit('select', e.native || e.shortcodes)
onEmojiSelect({ native, src, alt, name }: any) {
native
? emit('select', native)
: emit('selectCustom', { src, alt, 'data-emoji-id': name })
},
theme: isDark.value ? 'dark' : 'light',
custom: customEmojisData.value,