diff --git a/components/tiptap/TiptapEmojiList.vue b/components/tiptap/TiptapEmojiList.vue index cd58eee4..0efcda9c 100644 --- a/components/tiptap/TiptapEmojiList.vue +++ b/components/tiptap/TiptapEmojiList.vue @@ -40,6 +40,9 @@ watch(items, () => { }) function onKeyDown(event: KeyboardEvent) { + if (items.length === 0) + return false + if (event.key === 'ArrowUp') { selectedIndex = ((selectedIndex + items.length) - 1) % items.length return true diff --git a/components/tiptap/TiptapHashtagList.vue b/components/tiptap/TiptapHashtagList.vue index 0aa486aa..84bb344b 100644 --- a/components/tiptap/TiptapHashtagList.vue +++ b/components/tiptap/TiptapHashtagList.vue @@ -15,6 +15,9 @@ watch(items, () => { }) function onKeyDown(event: KeyboardEvent) { + if (items.length === 0) + return false + if (event.key === 'ArrowUp') { selectedIndex = ((selectedIndex + items.length) - 1) % items.length return true diff --git a/components/tiptap/TiptapMentionList.vue b/components/tiptap/TiptapMentionList.vue index 81f0e5c6..f2ab0d2d 100644 --- a/components/tiptap/TiptapMentionList.vue +++ b/components/tiptap/TiptapMentionList.vue @@ -15,6 +15,9 @@ watch(items, () => { }) function onKeyDown(event: KeyboardEvent) { + if (items.length === 0) + return false + if (event.key === 'ArrowUp') { selectedIndex = ((selectedIndex + items.length) - 1) % items.length return true