2023-07-27 08:31:52 +03:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
<template>
|
2023-11-02 12:59:18 +02: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 21:37:25 +02:00
|
|
|
</template>
|
|
|
|
|
2022-01-14 03:35:32 +02:00
|
|
|
<script lang="ts" setup>
|
2023-11-02 12:59:18 +02:00
|
|
|
import { defineAsyncComponent, shallowRef } from 'vue';
|
|
|
|
import { useTooltip } from '@/scripts/use-tooltip.js';
|
|
|
|
import * as os from '@/os.js';
|
2020-10-17 14:12:00 +03:00
|
|
|
|
2022-01-14 03:35:32 +02:00
|
|
|
const props = defineProps<{
|
|
|
|
reaction: string;
|
|
|
|
noStyle?: boolean;
|
2023-01-26 08:48:12 +02:00
|
|
|
emojiUrl?: string;
|
2023-11-02 12:59:18 +02:00
|
|
|
withTooltip?: boolean;
|
2022-01-14 03:35:32 +02:00
|
|
|
}>();
|
2023-11-02 12:59:18 +02: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 21:37:25 +02:00
|
|
|
</script>
|