From ce6b4fe18ca2167370fe7afef514749a323280f0 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih Date: Sun, 21 Jan 2024 19:18:57 +0900 Subject: [PATCH] =?UTF-8?q?fix(tools/cemojip):=20id=E3=81=8C=E8=A2=AB?= =?UTF-8?q?=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 2 +- pages/tools/custom-emoji-preview.vue | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c022fe13..ef14ec00 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -331,7 +331,7 @@ _customEmojiPreview: text: "ノート文面" textDescription: "追加したカスタム絵文字は{emoji_id}で参照できます。" _placeholder: - noteText: "カスタム絵文字はこんな感じで表示されます→ :emoji_preview_0:\n文章を書き換えて、使い勝手を試してみてくださいね✨" + noteText: "カスタム絵文字はこんな感じで表示されます→ :emoji_preview_1:\n文章を書き換えて、使い勝手を試してみてくださいね✨" _api: _permissions: diff --git a/pages/tools/custom-emoji-preview.vue b/pages/tools/custom-emoji-preview.vue index e6b09eb3..07883886 100644 --- a/pages/tools/custom-emoji-preview.vue +++ b/pages/tools/custom-emoji-preview.vue @@ -83,7 +83,6 @@ import PlusIco from 'bi/plus-lg.svg'; import XIco from 'bi/x-lg.svg'; import SunIco from 'bi/sun.svg'; import MoonIco from 'bi/moon.svg'; -import { on } from 'events'; definePageMeta({ layout: 'tools', @@ -100,7 +99,7 @@ const emojis = ref<{ file: string | Blob; invertColorScheme: boolean; }[]>([{ - id: 0, + id: 1, file: '/img/emojis/rocket_3d.png', 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 nextId = computed(() => Math.max(0, ...emojis.value.map((emoji) => emoji.id)) + 1); + function deleteEmoji(index: number) { emojis.value.splice(index, 1); } @@ -133,7 +134,7 @@ function addEmoji() { if (!file) return; emojis.value.push({ - id: emojis.value.length, + id: nextId.value, file, invertColorScheme: false, });