From 207855b0e8da93e681c75aa7909d12b78e2e2200 Mon Sep 17 00:00:00 2001 From: Lhcfl Date: Sat, 20 Apr 2024 01:03:22 +0800 Subject: [PATCH] fix: use settings from reactionPicker for non-reaction emoji picker --- packages/client/src/components/MkEmojiPicker.vue | 12 +++--------- .../client/src/components/MkEmojiPickerDialog.vue | 2 +- packages/client/src/components/MkPostForm.vue | 2 +- packages/client/src/scripts/reaction-picker.ts | 4 ++-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/packages/client/src/components/MkEmojiPicker.vue b/packages/client/src/components/MkEmojiPicker.vue index afc2f15817..c731fe9b0e 100644 --- a/packages/client/src/components/MkEmojiPicker.vue +++ b/packages/client/src/components/MkEmojiPicker.vue @@ -231,15 +231,9 @@ const unicodeEmojiSkinToneLabels = [ i18n.ts._skinTones?.dark ?? "Dark", ]; -const size = computed(() => - props.asReactionPicker ? reactionPickerSize.value : 1, -); -const width = computed(() => - props.asReactionPicker ? reactionPickerWidth.value : 3, -); -const height = computed(() => - props.asReactionPicker ? reactionPickerHeight.value : 2, -); +const size = reactionPickerSize; +const width = reactionPickerWidth; +const height = reactionPickerHeight; const customEmojiCategories = emojiCategories; const customEmojis = instance.emojis; const q = ref(null); diff --git a/packages/client/src/components/MkEmojiPickerDialog.vue b/packages/client/src/components/MkEmojiPickerDialog.vue index 426bbf9469..decf49fd38 100644 --- a/packages/client/src/components/MkEmojiPickerDialog.vue +++ b/packages/client/src/components/MkEmojiPickerDialog.vue @@ -39,7 +39,7 @@ import { defaultStore } from "@/store"; withDefaults( defineProps<{ manualShowing?: boolean | null; - src?: HTMLElement; + src?: HTMLElement | null; showPinned?: boolean; asReactionPicker?: boolean; }>(), diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue index 0a03dbb30e..582da6c6d4 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -1188,7 +1188,7 @@ async function insertEmoji(ev: MouseEvent) { os.openEmojiPicker( (ev.currentTarget ?? ev.target) as HTMLElement, {}, - textareaEl.value, + textareaEl.value!, ); } diff --git a/packages/client/src/scripts/reaction-picker.ts b/packages/client/src/scripts/reaction-picker.ts index 353a032d32..207d582343 100644 --- a/packages/client/src/scripts/reaction-picker.ts +++ b/packages/client/src/scripts/reaction-picker.ts @@ -24,14 +24,14 @@ class ReactionPicker { }, { done: (reaction) => { - this.onChosen!(reaction); + this.onChosen?.(reaction); }, close: () => { this.manualShowing.value = false; }, closed: () => { this.src.value = null; - this.onClosed!(); + this.onClosed?.(); }, }, );