This commit is contained in:
tamaina
2023-01-16 09:39:58 +00:00
parent 9d64ac6d6f
commit 21e4c3dfe9
8 changed files with 74 additions and 61 deletions

View File

@@ -41,11 +41,12 @@ import MkTab from '@/components/MkTab.vue';
import * as os from '@/os';
import { customEmojis, getCustomEmojiCategories, getCustomEmojiTags } from '@/custom-emojis';
import { i18n } from '@/i18n';
import * as Misskey from 'misskey-js';
const customEmojiCategories = getCustomEmojiCategories();
const customEmojiTags = getCustomEmojiTags();
let q = $ref('');
let searchEmojis = $ref(null);
let searchEmojis = $ref<Misskey.entities.CustomEmoji[]>(null);
let selectedTags = $ref(new Set());
function search() {
@@ -55,9 +56,9 @@ function search() {
}
if (selectedTags.size === 0) {
searchEmojis = customEmojis.filter(emoji => emoji.name.includes(q) || emoji.aliases.includes(q));
searchEmojis = customEmojis.value.filter(emoji => emoji.name.includes(q) || emoji.aliases.includes(q));
} else {
searchEmojis = customEmojis.filter(emoji => (emoji.name.includes(q) || emoji.aliases.includes(q)) && [...selectedTags].every(t => emoji.aliases.includes(t)));
searchEmojis = customEmojis.value.filter(emoji => (emoji.name.includes(q) || emoji.aliases.includes(q)) && [...selectedTags].every(t => emoji.aliases.includes(t)));
}
}