2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2024-03-02 08:05:17 +01:00
|
|
|
<MkCustomEmoji v-if="reaction[0] === ':'" ref="elRef" :name="reaction" :normal="true" :noStyle="noStyle" :url="emojiUrl" :fallbackToImage="true"/>
|
2023-11-02 11:59:18 +01:00
|
|
|
<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>
|