refac
This commit is contained in:
1 parent
18adb28da0
commit
5e4e1cf662
4 files changed
+48
-12
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<script lang="ts">
|
||||
import { copyToClipboard, unescapeHtml } from '$lib/utils';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
import { getContext } from 'svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
export let token;
|
||||
export let done = true;
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
||||
{#if done}
|
||||
<code
|
||||
class="codespan cursor-pointer"
|
||||
on:click={() => {
|
||||
copyToClipboard(unescapeHtml(token.text));
|
||||
toast.success($i18n.t('Copied to clipboard'));
|
||||
}}>{unescapeHtml(token.text)}</code
|
||||
>
|
||||
{:else}
|
||||
<code
|
||||
transition:fade={{ duration: 100 }}
|
||||
class="codespan cursor-pointer"
|
||||
on:click={() => {
|
||||
copyToClipboard(unescapeHtml(token.text));
|
||||
toast.success($i18n.t('Copied to clipboard'));
|
||||
}}>{unescapeHtml(token.text)}</code
|
||||
>
|
||||
{/if}
|
||||
@@ -12,7 +12,7 @@
|
||||
{token?.raw}
|
||||
{:else}
|
||||
{#each texts as text}
|
||||
<span class="" transition:fade>
|
||||
<span class="" transition:fade={{ duration: 100 }}>
|
||||
{text}
|
||||
</span>
|
||||
{/each}
|
||||
|
||||
Reference in new issue
Block a user