diff --git a/packages/frontend/src/components/MkAutocomplete.vue b/packages/frontend/src/components/MkAutocomplete.vue index 2f3855266..06de95ab1 100644 --- a/packages/frontend/src/components/MkAutocomplete.vue +++ b/packages/frontend/src/components/MkAutocomplete.vue @@ -15,12 +15,12 @@ SPDX-License-Identifier: AGPL-3.0-only
  • {{ i18n.ts.selectUser }}
  • -
      +
      1. {{ hashtag }}
      -
        +
        1. @@ -30,12 +30,12 @@ SPDX-License-Identifier: AGPL-3.0-only ({{ emoji.aliasOf }})
        -
          +
          1. {{ tag }}
          -
            +
            1. {{ param }}
            2. @@ -59,9 +59,41 @@ import { customEmojis } from '@/custom-emojis.js'; import { MFM_TAGS, MFM_PARAMS } from '@/const.js'; import { searchEmoji, EmojiDef } from '@/scripts/search-emoji.js'; +export type CompleteInfo = { + user: { + payload: any; + query: string | null; + }, + hashtag: { + payload: string; + query: string; + }, + // `:emo` -> `:emoji:` or some unicode emoji + emoji: { + payload: string; + query: string; + }, + // like emoji but for `:emoji:` -> unicode emoji + emojiComplete: { + payload: string; + query: string; + }, + mfmTag: { + payload: string; + query: string; + }, + mfmParam: { + payload: string; + query: { + tag: string; + params: string[]; + }; + }, +} + const lib = emojilist.filter(x => x.category !== 'flags'); -const emojiDb = computed(() => { +const unicodeEmojiDB = computed(() => { //#region Unicode Emoji const char2path = defaultStore.reactiveState.emojiStyle.value === 'twemoji' ? char2twemojiFilePath : char2fluentEmojiFilePath; @@ -87,6 +119,10 @@ const emojiDb = computed(() => { unicodeEmojiDB.sort((a, b) => a.name.length - b.name.length); //#endregion + return unicodeEmojiDB; +}); + +const emojiDb = computed(() => { //#region Custom Emoji const customEmojiDB: EmojiDef[] = []; @@ -112,7 +148,7 @@ const emojiDb = computed(() => { customEmojiDB.sort((a, b) => a.name.length - b.name.length); //#endregion - return markRaw([...customEmojiDB, ...unicodeEmojiDB]); + return markRaw([...customEmojiDB, ...unicodeEmojiDB.value]); }); export default { @@ -121,18 +157,23 @@ export default { }; -