2025-09-14 22:49:01 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import type { Token } from 'marked';
|
2025-09-14 22:59:09 +00:00
|
|
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
2025-09-14 22:49:01 +00:00
|
|
|
|
|
|
|
|
export let token: Token;
|
2025-09-16 20:16:48 +00:00
|
|
|
|
|
|
|
|
let triggerChar = '';
|
|
|
|
|
let label = '';
|
|
|
|
|
|
|
|
|
|
let idType = '';
|
|
|
|
|
let id = '';
|
|
|
|
|
|
|
|
|
|
$: if (token) {
|
|
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const init = () => {
|
|
|
|
|
const _id = token?.id;
|
|
|
|
|
if (_id?.includes(':')) {
|
|
|
|
|
idType = _id.split(':')[0];
|
|
|
|
|
id = _id.split(':')[1];
|
|
|
|
|
} else {
|
|
|
|
|
id = _id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
label = token?.label ?? id;
|
|
|
|
|
triggerChar = token?.triggerChar ?? '@';
|
|
|
|
|
};
|
2025-09-14 22:49:01 +00:00
|
|
|
</script>
|
|
|
|
|
|
2025-09-16 20:16:48 +00:00
|
|
|
<Tooltip as="span" className="mention" content={id} placement="top">
|
|
|
|
|
{triggerChar}{label}
|
2025-09-14 22:49:01 +00:00
|
|
|
</Tooltip>
|