mirror of
https://github.com/open-webui/open-webui
synced 2025-02-19 19:38:52 +00:00
refac: code rendering
This commit is contained in:
parent
6fdfa62845
commit
c3862bc387
@ -33,20 +33,24 @@
|
|||||||
<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'}
|
||||||
<CodeBlock
|
{#if token.raw.includes('```')}
|
||||||
id={`${id}-${tokenIdx}`}
|
<CodeBlock
|
||||||
{token}
|
id={`${id}-${tokenIdx}`}
|
||||||
lang={token?.lang ?? ''}
|
{token}
|
||||||
code={revertSanitizedResponseContent(token?.text ?? '')}
|
lang={token?.lang ?? ''}
|
||||||
{save}
|
code={revertSanitizedResponseContent(token?.text ?? '')}
|
||||||
on:save={(e) => {
|
{save}
|
||||||
dispatch('update', {
|
on:save={(e) => {
|
||||||
raw: token.raw,
|
dispatch('update', {
|
||||||
oldContent: token.text,
|
raw: token.raw,
|
||||||
newContent: e.detail
|
oldContent: token.text,
|
||||||
});
|
newContent: e.detail
|
||||||
}}
|
});
|
||||||
/>
|
}}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
{unescapeHtml(token.text)}
|
||||||
|
{/if}
|
||||||
{:else if token.type === 'table'}
|
{:else if token.type === 'table'}
|
||||||
<div class="scrollbar-hidden relative whitespace-nowrap overflow-x-auto max-w-full">
|
<div class="scrollbar-hidden relative whitespace-nowrap overflow-x-auto max-w-full">
|
||||||
<table class="w-full">
|
<table class="w-full">
|
||||||
|
Loading…
Reference in New Issue
Block a user