fix(tools/cemojip): idが被る問題を修正

This commit is contained in:
kakkokari-gtyih 2024-01-21 19:18:57 +09:00
parent ea2080b624
commit ce6b4fe18c
2 changed files with 5 additions and 4 deletions

View File

@ -331,7 +331,7 @@ _customEmojiPreview:
text: "ノート文面" text: "ノート文面"
textDescription: "追加したカスタム絵文字は{emoji_id}で参照できます。" textDescription: "追加したカスタム絵文字は{emoji_id}で参照できます。"
_placeholder: _placeholder:
noteText: "カスタム絵文字はこんな感じで表示されます→ :emoji_preview_0:\n文章を書き換えて、使い勝手を試してみてくださいね✨" noteText: "カスタム絵文字はこんな感じで表示されます→ :emoji_preview_1:\n文章を書き換えて、使い勝手を試してみてくださいね✨"
_api: _api:
_permissions: _permissions:

View File

@ -83,7 +83,6 @@ import PlusIco from 'bi/plus-lg.svg';
import XIco from 'bi/x-lg.svg'; import XIco from 'bi/x-lg.svg';
import SunIco from 'bi/sun.svg'; import SunIco from 'bi/sun.svg';
import MoonIco from 'bi/moon.svg'; import MoonIco from 'bi/moon.svg';
import { on } from 'events';
definePageMeta({ definePageMeta({
layout: 'tools', layout: 'tools',
@ -100,7 +99,7 @@ const emojis = ref<{
file: string | Blob; file: string | Blob;
invertColorScheme: boolean; invertColorScheme: boolean;
}[]>([{ }[]>([{
id: 0, id: 1,
file: '/img/emojis/rocket_3d.png', file: '/img/emojis/rocket_3d.png',
invertColorScheme: false, invertColorScheme: false,
}]); }]);
@ -114,6 +113,8 @@ const noteReactions = computed(() => emojis.value?.map((emoji) => ({
const customEmojisDefinition = computed(() => Object.fromEntries(noteReactions.value?.map((emoji) => [ emoji.code, emoji.url ]) ?? [])); const customEmojisDefinition = computed(() => Object.fromEntries(noteReactions.value?.map((emoji) => [ emoji.code, emoji.url ]) ?? []));
const nextId = computed(() => Math.max(0, ...emojis.value.map((emoji) => emoji.id)) + 1);
function deleteEmoji(index: number) { function deleteEmoji(index: number) {
emojis.value.splice(index, 1); emojis.value.splice(index, 1);
} }
@ -133,7 +134,7 @@ function addEmoji() {
if (!file) return; if (!file) return;
emojis.value.push({ emojis.value.push({
id: emojis.value.length, id: nextId.value,
file, file,
invertColorScheme: false, invertColorScheme: false,
}); });