This commit is contained in:
syuilo 2024-08-27 19:59:53 +09:00
parent e41ba1d177
commit 9ea7f21a95
2 changed files with 5 additions and 9 deletions

View File

@ -11,6 +11,7 @@ import { createApp, defineAsyncComponent } from 'vue';
import lightTheme from '@@/themes/l-light.json5'; import lightTheme from '@@/themes/l-light.json5';
import darkTheme from '@@/themes/d-dark.json5'; import darkTheme from '@@/themes/d-dark.json5';
import { applyTheme } from './theme.js'; import { applyTheme } from './theme.js';
import { fetchCustomEmojis } from './custom-emojis.js';
import { setIframeId } from '@/post-message.js'; import { setIframeId } from '@/post-message.js';
import { parseEmbedParams } from '@/embed-page.js'; import { parseEmbedParams } from '@/embed-page.js';
@ -36,6 +37,10 @@ function setIframeIdHandler(event: MessageEvent) {
window.addEventListener('message', setIframeIdHandler); window.addEventListener('message', setIframeIdHandler);
try {
await fetchCustomEmojis();
} catch (err) { /* empty */ }
const app = createApp( const app = createApp(
defineAsyncComponent(() => import('@/ui.vue')), defineAsyncComponent(() => import('@/ui.vue')),
); );

View File

@ -19,15 +19,6 @@ function set(key: string, value: any) {
const storageCache = await get('emojis'); const storageCache = await get('emojis');
export const customEmojis = shallowRef<Misskey.entities.EmojiSimple[]>(Array.isArray(storageCache) ? storageCache : []); export const customEmojis = shallowRef<Misskey.entities.EmojiSimple[]>(Array.isArray(storageCache) ? storageCache : []);
export const customEmojiCategories = computed<[ ...string[], null ]>(() => {
const categories = new Set<string>();
for (const emoji of customEmojis.value) {
if (emoji.category && emoji.category !== 'null') {
categories.add(emoji.category);
}
}
return markRaw([...Array.from(categories), null]);
});
export const customEmojisMap = new Map<string, Misskey.entities.EmojiSimple>(); export const customEmojisMap = new Map<string, Misskey.entities.EmojiSimple>();
watch(customEmojis, emojis => { watch(customEmojis, emojis => {