diff --git a/CHANGELOG.md b/CHANGELOG.md index 1924805849..58e93ca954 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -136,6 +136,7 @@ - Fix: iPadOSでdeck uiをマウスカーソルによってスクロールできない問題を修正 - NOTE: 構造上クラシックUIを新しいデザインシステムに移行することが困難なため、クラシックUIが削除されました - デッキUIでカラムを中央寄せにし、メインカラムの左右にウィジェットカラムを配置し、ナビゲーションバーを上部に表示することである程度クラシックUIを再現できます +- Fix: Unicode絵文字とカスタム絵文字の名前が重複したときにカスタム絵文字がオートコンプリートにサジェストされない問題を修正 ### Server - Enhance 全体的なパフォーマンス向上 diff --git a/packages/frontend/src/utility/search-emoji.ts b/packages/frontend/src/utility/search-emoji.ts index 4cda880bff..25cfa965a8 100644 --- a/packages/frontend/src/utility/search-emoji.ts +++ b/packages/frontend/src/utility/search-emoji.ts @@ -25,7 +25,7 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30) // 完全一致(エイリアスなし) emojiDb.some(x => { if (x.name === query && !x.aliasOf) { - matched.set(x.name, { emoji: x, score: query.length + 3 }); + matched.set(x.emoji, { emoji: x, score: query.length + 3 }); } return matched.size === max; }); @@ -33,8 +33,8 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30) // 完全一致(エイリアス込み) if (matched.size < max) { emojiDb.some(x => { - if (x.name === query && !matched.has(x.aliasOf ?? x.name)) { - matched.set(x.aliasOf ?? x.name, { emoji: x, score: query.length + 2 }); + if (x.name === query && !matched.has(x.emoji)) { + matched.set(x.emoji, { emoji: x, score: query.length + 2 }); } return matched.size === max; }); @@ -43,8 +43,8 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30) // 前方一致(エイリアスなし) if (matched.size < max) { emojiDb.some(x => { - if (x.name.startsWith(query) && !x.aliasOf && !matched.has(x.name)) { - matched.set(x.name, { emoji: x, score: query.length + 1 }); + if (x.name.startsWith(query) && !x.aliasOf && !matched.has(x.emoji)) { + matched.set(x.emoji, { emoji: x, score: query.length + 1 }); } return matched.size === max; }); @@ -53,8 +53,8 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30) // 前方一致(エイリアス込み) if (matched.size < max) { emojiDb.some(x => { - if (x.name.startsWith(query) && !matched.has(x.aliasOf ?? x.name)) { - matched.set(x.aliasOf ?? x.name, { emoji: x, score: query.length }); + if (x.name.startsWith(query) && !matched.has(x.emoji)) { + matched.set(x.emoji, { emoji: x, score: query.length }); } return matched.size === max; }); @@ -63,8 +63,8 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30) // 部分一致(エイリアス込み) if (matched.size < max) { emojiDb.some(x => { - if (x.name.includes(query) && !matched.has(x.aliasOf ?? x.name)) { - matched.set(x.aliasOf ?? x.name, { emoji: x, score: query.length - 1 }); + if (x.name.includes(query) && !matched.has(x.emoji)) { + matched.set(x.emoji, { emoji: x, score: query.length - 1 }); } return matched.size === max; }); @@ -87,8 +87,8 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30) } // 半分以上の文字が含まれていればヒットとする - if (hit > Math.ceil(queryChars.length / 2) && hit - 2 > (matched.get(x.aliasOf ?? x.name)?.score ?? 0)) { - hitEmojis.set(x.aliasOf ?? x.name, { emoji: x, score: hit - 2 }); + if (hit > Math.ceil(queryChars.length / 2) && hit - 2 > (matched.get(x.emoji)?.score ?? 0)) { + hitEmojis.set(x.emoji, { emoji: x, score: hit - 2 }); } }