fix: emoji picker not showing emojis (#569)
This commit is contained in:
parent
f4bd2cab5c
commit
1c61aef83b
|
@ -10,8 +10,14 @@ const el = $ref<HTMLElement>()
|
||||||
let picker = $ref<Picker>()
|
let picker = $ref<Picker>()
|
||||||
|
|
||||||
async function openEmojiPicker() {
|
async function openEmojiPicker() {
|
||||||
if (!picker) {
|
|
||||||
await updateCustomEmojis()
|
await updateCustomEmojis()
|
||||||
|
if (picker) {
|
||||||
|
picker.update({
|
||||||
|
theme: isDark.value ? 'dark' : 'light',
|
||||||
|
custom: customEmojisData.value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
const promise = import('@emoji-mart/data').then(r => r.default)
|
const promise = import('@emoji-mart/data').then(r => r.default)
|
||||||
const { Picker } = await import('emoji-mart')
|
const { Picker } = await import('emoji-mart')
|
||||||
picker = new Picker({
|
picker = new Picker({
|
||||||
|
@ -28,28 +34,16 @@ async function openEmojiPicker() {
|
||||||
el?.appendChild(picker as any as HTMLElement)
|
el?.appendChild(picker as any as HTMLElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
const hidePicker = () => {
|
const hideEmojiPicker = () => {
|
||||||
if (picker)
|
if (picker)
|
||||||
el?.removeChild(picker as any as HTMLElement)
|
el?.removeChild(picker as any as HTMLElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(isDark, () => {
|
|
||||||
picker?.update({
|
|
||||||
theme: isDark.value ? 'dark' : 'light',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
watch(customEmojisData, () => {
|
|
||||||
picker?.update({
|
|
||||||
custom: customEmojisData.value,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VDropdown
|
<VDropdown
|
||||||
@apply-show="openEmojiPicker()"
|
@apply-show="openEmojiPicker()"
|
||||||
@apply-hide="hidePicker()"
|
@apply-hide="hideEmojiPicker()"
|
||||||
>
|
>
|
||||||
<button btn-action-icon :title="$t('tooltip.emoji')">
|
<button btn-action-icon :title="$t('tooltip.emoji')">
|
||||||
<div i-ri:emotion-line />
|
<div i-ri:emotion-line />
|
||||||
|
|
Loading…
Reference in a new issue