anki/ts/deckoptions/TooltipLabel.svelte
2021-06-21 17:02:48 +02:00

20 lines
629 B
Svelte

<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="typescript">
import marked from "marked";
import { infoCircle } from "./icons";
import WithTooltip from "./WithTooltip.svelte";
import Label from "./Label.svelte";
import Badge from "./Badge.svelte";
export let markdownTooltip: string;
</script>
<WithTooltip tooltip={marked(markdownTooltip)} let:createTooltip>
<Label on:mount={(event) => createTooltip(event.detail.span)}
><slot /><Badge>{@html infoCircle}</Badge>
</Label>
</WithTooltip>