From 34beab24b78f74427c8257289b1c37d44a372795 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Thu, 29 Jun 2023 21:12:55 -0700 Subject: [PATCH 1/2] fix --- packages/client/src/components/MkEmojiPickerDialog.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/components/MkEmojiPickerDialog.vue b/packages/client/src/components/MkEmojiPickerDialog.vue index 4cff9f275..fec014e40 100644 --- a/packages/client/src/components/MkEmojiPickerDialog.vue +++ b/packages/client/src/components/MkEmojiPickerDialog.vue @@ -65,7 +65,7 @@ function chosen(emoji: any) { } function opening() { - picker.value?.reset(); + // picker.value?.reset(); picker.value?.focus(); } From 05d869d0fc315ae62ee856bba22fbed921ef0564 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Thu, 29 Jun 2023 21:34:09 -0700 Subject: [PATCH 2/2] fix: :bug: addSkinTone strip logic --- packages/client/src/scripts/emojilist.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/client/src/scripts/emojilist.ts b/packages/client/src/scripts/emojilist.ts index 894c6461e..b042c2666 100644 --- a/packages/client/src/scripts/emojilist.ts +++ b/packages/client/src/scripts/emojilist.ts @@ -1,5 +1,6 @@ import data from "unicode-emoji-json/data-by-group.json"; import emojiComponents from "unicode-emoji-json/data-emoji-components.json"; +import individualData from "unicode-emoji-json/data-by-emoji.json"; import keywordSet from "emojilib"; import { defaultStore } from "@/store"; @@ -36,8 +37,6 @@ export const categoryMapping = { } as const; export function addSkinTone(emoji: string, skinTone?: number) { - const individualData = import("unicode-emoji-json/data-by-emoji.json"); - const chosenSkinTone = skinTone || defaultStore.state.reactionPickerSkinTone; const skinToneModifiers = [ "", @@ -47,15 +46,15 @@ export function addSkinTone(emoji: string, skinTone?: number) { emojiComponents.medium_dark_skin_tone, emojiComponents.dark_skin_tone, ]; - if (individualData[emoji]?.skin_tone_support === false) { + const strippedEmoji = emoji.replace( + new RegExp(`(${skinToneModifiers.slice(1).join("|")})`, "gi"), + "", + ); + if (individualData[strippedEmoji].skin_tone_support) { + return strippedEmoji + (skinToneModifiers[chosenSkinTone - 1] || ""); + } else { return emoji; } - return ( - emoji.replace( - new RegExp(`(${skinToneModifiers.slice(1).join("|")})`, "gi"), - "", - ) + (skinToneModifiers[chosenSkinTone - 1] || "") - ); } const unicodeFifteenEmojis = [