mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-17 23:52:29 +00:00
Click to copy LaTeX from UI
This commit is contained in:
parent
4e2240aada
commit
83dd99e74f
1 changed files with 17 additions and 1 deletions
|
|
@ -17,6 +17,12 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { copyToClipboard } from '$lib/utils';
|
||||
import { toast } from 'svelte-sonner';
|
||||
|
||||
import { getContext } from 'svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
export let content: string;
|
||||
export let displayMode: boolean = false;
|
||||
|
|
@ -29,5 +35,15 @@
|
|||
</script>
|
||||
|
||||
{#if renderToString}
|
||||
{@html renderToString(content, { displayMode, throwOnError: false })}
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
||||
<code
|
||||
class="cursor-pointer {displayMode ? 'block text-center my-4' : 'inline'}"
|
||||
onclick={() => {
|
||||
copyToClipboard(content);
|
||||
toast.success($i18n.t('Copied to clipboard'));
|
||||
}}
|
||||
>
|
||||
{@html renderToString(content, { displayMode, throwOnError: false })}
|
||||
</code>
|
||||
{/if}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue