|
@@ -13,6 +13,7 @@
|
|
import Image from '$lib/components/common/Image.svelte';
|
|
import Image from '$lib/components/common/Image.svelte';
|
|
import KatexRenderer from './KatexRenderer.svelte';
|
|
import KatexRenderer from './KatexRenderer.svelte';
|
|
import Source from './Source.svelte';
|
|
import Source from './Source.svelte';
|
|
|
|
+ import HtmlToken from './HTMLToken.svelte';
|
|
|
|
|
|
export let id: string;
|
|
export let id: string;
|
|
export let tokens: Token[];
|
|
export let tokens: Token[];
|
|
@@ -23,16 +24,7 @@
|
|
{#if token.type === 'escape'}
|
|
{#if token.type === 'escape'}
|
|
{unescapeHtml(token.text)}
|
|
{unescapeHtml(token.text)}
|
|
{:else if token.type === 'html'}
|
|
{:else if token.type === 'html'}
|
|
- {@const html = DOMPurify.sanitize(token.text)}
|
|
|
|
- {#if html && html.includes('<video')}
|
|
|
|
- {@html html}
|
|
|
|
- {:else if token.text.includes(`<iframe src="${WEBUI_BASE_URL}/api/v1/files/`)}
|
|
|
|
- {@html `${token.text}`}
|
|
|
|
- {:else if token.text.includes(`<source_id`)}
|
|
|
|
- <Source {id} {token} onClick={onSourceClick} />
|
|
|
|
- {:else}
|
|
|
|
- {@html html}
|
|
|
|
- {/if}
|
|
|
|
|
|
+ <HtmlToken {id} {token} {onSourceClick} />
|
|
{:else if token.type === 'link'}
|
|
{:else if token.type === 'link'}
|
|
{#if token.tokens}
|
|
{#if token.tokens}
|
|
<a href={token.href} target="_blank" rel="nofollow" title={token.title}>
|
|
<a href={token.href} target="_blank" rel="nofollow" title={token.title}>
|