forked from Mirrors/elk
fix: emoji picker stops showing (#559)
This commit is contained in:
parent
cf261c36cd
commit
7405dee7f6
1 changed files with 10 additions and 3 deletions
|
@ -11,7 +11,7 @@ let picker = $ref<Picker>()
|
||||||
|
|
||||||
async function openEmojiPicker() {
|
async function openEmojiPicker() {
|
||||||
if (!picker) {
|
if (!picker) {
|
||||||
updateCustomEmojis()
|
await updateCustomEmojis()
|
||||||
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({
|
||||||
|
@ -22,9 +22,15 @@ async function openEmojiPicker() {
|
||||||
theme: isDark.value ? 'dark' : 'light',
|
theme: isDark.value ? 'dark' : 'light',
|
||||||
custom: customEmojisData.value,
|
custom: customEmojisData.value,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
await nextTick()
|
||||||
// TODO: custom picker
|
// TODO: custom picker
|
||||||
el?.appendChild(picker as any as HTMLElement)
|
el?.appendChild(picker as any as HTMLElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hidePicker = () => {
|
||||||
|
if (picker)
|
||||||
|
el?.removeChild(picker as any as HTMLElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(isDark, () => {
|
watch(isDark, () => {
|
||||||
|
@ -43,6 +49,7 @@ watch(customEmojisData, () => {
|
||||||
<template>
|
<template>
|
||||||
<VDropdown
|
<VDropdown
|
||||||
@apply-show="openEmojiPicker()"
|
@apply-show="openEmojiPicker()"
|
||||||
|
@apply-hide="hidePicker()"
|
||||||
>
|
>
|
||||||
<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