mirror of
https://github.com/open-webui/open-webui.git
synced 2026-02-24 04:00:31 +01:00
refac
This commit is contained in:
@@ -54,7 +54,9 @@
|
||||
console.log('Exporting table to CSV');
|
||||
|
||||
// Extract header row text, decode HTML entities, and escape for CSV.
|
||||
const header = token.header.map((headerCell) => `"${decode(headerCell.text).replace(/"/g, '""')}"`);
|
||||
const header = token.header.map(
|
||||
(headerCell) => `"${decode(headerCell.text).replace(/"/g, '""')}"`
|
||||
);
|
||||
|
||||
// Create an array for rows that will hold the mapped cell text.
|
||||
const rows = token.rows.map((row) =>
|
||||
@@ -316,26 +318,41 @@
|
||||
</ul>
|
||||
{/if}
|
||||
{:else if token.type === 'details'}
|
||||
<Collapsible
|
||||
title={token.summary}
|
||||
open={$settings?.expandDetails ?? false}
|
||||
attributes={token?.attributes}
|
||||
className="w-full space-y-1"
|
||||
dir="auto"
|
||||
>
|
||||
<div class=" mb-1.5" slot="content">
|
||||
<svelte:self
|
||||
id={`${id}-${tokenIdx}-d`}
|
||||
tokens={marked.lexer(decode(token.text))}
|
||||
attributes={token?.attributes}
|
||||
{done}
|
||||
{editCodeBlock}
|
||||
{onTaskClick}
|
||||
{sourceIds}
|
||||
{onSourceClick}
|
||||
/>
|
||||
</div>
|
||||
</Collapsible>
|
||||
{@const textContent = decode(token.text || '')
|
||||
.replace(/<summary>.*?<\/summary>/gi, '')
|
||||
.trim()}
|
||||
|
||||
{#if textContent.length > 0}
|
||||
<Collapsible
|
||||
title={token.summary}
|
||||
open={$settings?.expandDetails ?? false}
|
||||
attributes={token?.attributes}
|
||||
className="w-full space-y-1"
|
||||
dir="auto"
|
||||
>
|
||||
<div class=" mb-1.5" slot="content">
|
||||
<svelte:self
|
||||
id={`${id}-${tokenIdx}-d`}
|
||||
tokens={marked.lexer(decode(token.text))}
|
||||
attributes={token?.attributes}
|
||||
{done}
|
||||
{editCodeBlock}
|
||||
{onTaskClick}
|
||||
{sourceIds}
|
||||
{onSourceClick}
|
||||
/>
|
||||
</div>
|
||||
</Collapsible>
|
||||
{:else}
|
||||
<Collapsible
|
||||
title={token.summary}
|
||||
open={false}
|
||||
disabled={true}
|
||||
attributes={token?.attributes}
|
||||
className="w-full space-y-1"
|
||||
dir="auto"
|
||||
/>
|
||||
{/if}
|
||||
{:else if token.type === 'html'}
|
||||
<HtmlToken {id} {token} {onSourceClick} />
|
||||
{:else if token.type === 'iframe'}
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="{buttonClassName} cursor-pointer"
|
||||
class="{buttonClassName} {disabled ? '' : 'cursor-pointer'}"
|
||||
on:pointerup={() => {
|
||||
if (!disabled) {
|
||||
open = !open;
|
||||
@@ -270,13 +270,15 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="flex self-center translate-y-[1px]">
|
||||
{#if open}
|
||||
<ChevronUp strokeWidth="3.5" className="size-3.5" />
|
||||
{:else}
|
||||
<ChevronDown strokeWidth="3.5" className="size-3.5" />
|
||||
{/if}
|
||||
</div>
|
||||
{#if !disabled}
|
||||
<div class="flex self-center translate-y-[1px]">
|
||||
{#if open}
|
||||
<ChevronUp strokeWidth="3.5" className="size-3.5" />
|
||||
{:else}
|
||||
<ChevronDown strokeWidth="3.5" className="size-3.5" />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
|
||||
Reference in New Issue
Block a user