2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-11-02 11:59:18 +01:00
|
|
|
<MkCustomEmoji v-if="reaction[0] === ':'" ref="elRef" :name="reaction" :normal="true" :noStyle="noStyle" :url="emojiUrl"/>
|
|
|
|
<MkEmoji v-else ref="elRef" :emoji="reaction" :normal="true" :noStyle="noStyle"/>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2022-01-14 02:35:32 +01:00
|
|
|
<script lang="ts" setup>
|
2023-11-02 11:59:18 +01:00
|
|
|
import { defineAsyncComponent, shallowRef } from 'vue';
|
|
|
|
import { useTooltip } from '@/scripts/use-tooltip.js';
|
|
|
|
import * as os from '@/os.js';
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-01-14 02:35:32 +01:00
|
|
|
const props = defineProps<{
|
|
|
|
reaction: string;
|
|
|
|
noStyle?: boolean;
|
2023-01-26 07:48:12 +01:00
|
|
|
emojiUrl?: string;
|
2023-11-02 11:59:18 +01:00
|
|
|
withTooltip?: boolean;
|
2022-01-14 02:35:32 +01:00
|
|
|
}>();
|
2023-11-02 11:59:18 +01:00
|
|
|
|
|
|
|
const elRef = shallowRef();
|
|
|
|
|
|
|
|
if (props.withTooltip) {
|
|
|
|
useTooltip(elRef, (showing) => {
|
|
|
|
os.popup(defineAsyncComponent(() => import('@/components/MkReactionTooltip.vue')), {
|
|
|
|
showing,
|
|
|
|
reaction: props.reaction.replace(/^:(\w+):$/, ':$1@.:'),
|
|
|
|
targetElement: elRef.value.$el,
|
|
|
|
}, {}, 'closed');
|
|
|
|
});
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|