mirror of
https://github.com/open-webui/open-webui
synced 2025-02-22 05:08:14 +00:00
enh: automatic artifacts toggle
This commit is contained in:
parent
6d2eaaf602
commit
aeaf761ecd
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import Markdown from './Markdown.svelte';
|
import Markdown from './Markdown.svelte';
|
||||||
import LightBlub from '$lib/components/icons/LightBlub.svelte';
|
import LightBlub from '$lib/components/icons/LightBlub.svelte';
|
||||||
|
import { showArtifacts, showControls, showOverview } from '$lib/stores';
|
||||||
|
|
||||||
export let id;
|
export let id;
|
||||||
export let content;
|
export let content;
|
||||||
@ -69,6 +70,13 @@
|
|||||||
on:update={(e) => {
|
on:update={(e) => {
|
||||||
dispatch('update', e.detail);
|
dispatch('update', e.detail);
|
||||||
}}
|
}}
|
||||||
|
on:code={(e) => {
|
||||||
|
const { lang } = e.detail;
|
||||||
|
if (lang === 'html') {
|
||||||
|
showArtifacts.set(true);
|
||||||
|
showControls.set(true);
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -42,5 +42,8 @@
|
|||||||
on:update={(e) => {
|
on:update={(e) => {
|
||||||
dispatch('update', e.detail);
|
dispatch('update', e.detail);
|
||||||
}}
|
}}
|
||||||
|
on:code={(e) => {
|
||||||
|
dispatch('code', e.detail);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{/key}
|
{/key}
|
||||||
|
@ -33,6 +33,11 @@
|
|||||||
<MarkdownInlineTokens id={`${id}-${tokenIdx}-h`} tokens={token.tokens} />
|
<MarkdownInlineTokens id={`${id}-${tokenIdx}-h`} tokens={token.tokens} />
|
||||||
</svelte:element>
|
</svelte:element>
|
||||||
{:else if token.type === 'code'}
|
{:else if token.type === 'code'}
|
||||||
|
{#if token.lang === 'html'}
|
||||||
|
{dispatch('code', {
|
||||||
|
lang: token.lang
|
||||||
|
})}
|
||||||
|
{/if}
|
||||||
{#if token.raw.includes('```')}
|
{#if token.raw.includes('```')}
|
||||||
<CodeBlock
|
<CodeBlock
|
||||||
id={`${id}-${tokenIdx}`}
|
id={`${id}-${tokenIdx}`}
|
||||||
|
Loading…
Reference in New Issue
Block a user