@@ -273,7 +269,6 @@
diff --git a/fe_calckey/frontend/client/src/components/MkReactionTooltip.vue b/fe_calckey/frontend/client/src/components/MkReactionTooltip.vue
index 4a95b5d..70ac6e3 100644
--- a/fe_calckey/frontend/client/src/components/MkReactionTooltip.vue
+++ b/fe_calckey/frontend/client/src/components/MkReactionTooltip.vue
@@ -6,13 +6,17 @@
@closed="emit('closed')"
>
-
-
{{ reaction.replace("@.", "") }}
+
{{ magReactionToLegacy(reaction) }}
@@ -20,11 +24,11 @@
diff --git a/fe_calckey/frontend/client/src/components/global/MkEmoji.vue b/fe_calckey/frontend/client/src/components/global/MagEmoji.vue
similarity index 59%
rename from fe_calckey/frontend/client/src/components/global/MkEmoji.vue
rename to fe_calckey/frontend/client/src/components/global/MagEmoji.vue
index 352e1ac..9a3536f 100644
--- a/fe_calckey/frontend/client/src/components/global/MkEmoji.vue
+++ b/fe_calckey/frontend/client/src/components/global/MagEmoji.vue
@@ -1,6 +1,6 @@
import { computed } from "vue";
-import * as Misskey from "calckey-js";
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
import { char2filePath } from "@/scripts/twemoji-base";
import { defaultStore } from "@/store";
-import { instance } from "@/instance";
-import { packed } from "magnetar-common";
-import { magTransProperty } from "@/scripts-mag/mag-util";
+import { types } from "magnetar-common";
+import {
+ magIsCustomEmoji,
+ magIsUnicodeEmoji,
+ magReactionToLegacy,
+} from "@/scripts-mag/mag-util";
const props = defineProps<{
- emoji: string;
+ emoji: types.Reaction;
normal?: boolean;
noStyle?: boolean;
- customEmojis?: (
- | packed.PackEmojiBase
- | Pick
- )[];
isReaction?: boolean;
}>();
-const isCustom = computed(() => props.emoji.startsWith(":"));
-const char = computed(() => (isCustom.value ? null : props.emoji));
+const isCustom = computed(() => magIsCustomEmoji(props.emoji));
+
+const char = computed(() =>
+ magIsUnicodeEmoji(props.emoji) ? props.emoji : null
+);
const useOsNativeEmojis = computed(
() => defaultStore.state.useOsNativeEmojis && !props.isReaction
);
-const ce = computed(() => props.customEmojis ?? instance.emojis ?? []);
-const customEmoji = computed(() =>
- isCustom.value
- ? ce.value.find(
- (x) =>
- magTransProperty(x, "shortcode", "name") ===
- props.emoji.substring(1, props.emoji.length - 1)
- )
- : null
-);
const url = computed(() => {
if (char.value) {
return char2filePath(char.value);
- } else if (customEmoji?.value?.url) {
+ } else if (magIsCustomEmoji(props.emoji)) {
return defaultStore.state.disableShowingAnimatedImages
- ? getStaticImageUrl(customEmoji.value.url)
- : customEmoji.value.url;
+ ? getStaticImageUrl(props.emoji.url)
+ : props.emoji.url;
} else {
return null;
}
});
-const alt = computed(() =>
- customEmoji.value
- ? `:${magTransProperty(customEmoji.value, "shortcode", "name")}:`
- : char.value
-);
+const alt = computed(() => magReactionToLegacy(props.emoji));