chore: format

This commit is contained in:
Timothy Jaeryang Baek
2026-02-16 01:26:29 -06:00
parent 5fda814669
commit ef04a704ce
61 changed files with 192 additions and 40 deletions
@@ -211,37 +211,47 @@
</div>
{#if document.metadata?.html}
<iframe
class="w-full border-0 h-auto rounded-none"
sandbox="allow-scripts allow-forms{($settings?.iframeSandboxAllowSameOrigin ??
false)
? ' allow-same-origin'
: ''}"
srcdoc={document.document}
title={$i18n.t('Content')}
></iframe>
{:else}
{@const rawContent = document.document.trim().replace(/\n\n+/g, '\n\n')}
{@const isTruncated = ($settings?.renderMarkdownInPreviews ?? true) && rawContent.length > CONTENT_PREVIEW_LIMIT && !expandedDocs.has(documentIdx)}
{#if $settings?.renderMarkdownInPreviews ?? true}
<div class="text-sm prose dark:prose-invert max-w-full">
<Markdown content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent} id="citation-{documentIdx}" />
</div>
{#if isTruncated}
<button
class="mt-1 text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
on:click={() => {
expandedDocs.add(documentIdx);
expandedDocs = expandedDocs;
}}
>
{$i18n.t('Show all ({{COUNT}} characters)', { COUNT: rawContent.length.toLocaleString() })}
</button>
<iframe
class="w-full border-0 h-auto rounded-none"
sandbox="allow-scripts allow-forms{($settings?.iframeSandboxAllowSameOrigin ??
false)
? ' allow-same-origin'
: ''}"
srcdoc={document.document}
title={$i18n.t('Content')}
></iframe>
{:else}
{@const rawContent = document.document.trim().replace(/\n\n+/g, '\n\n')}
{@const isTruncated =
($settings?.renderMarkdownInPreviews ?? true) &&
rawContent.length > CONTENT_PREVIEW_LIMIT &&
!expandedDocs.has(documentIdx)}
{#if $settings?.renderMarkdownInPreviews ?? true}
<div class="text-sm prose dark:prose-invert max-w-full">
<Markdown
content={isTruncated
? rawContent.slice(0, CONTENT_PREVIEW_LIMIT)
: rawContent}
id="citation-{documentIdx}"
/>
</div>
{#if isTruncated}
<button
class="mt-1 text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
on:click={() => {
expandedDocs.add(documentIdx);
expandedDocs = expandedDocs;
}}
>
{$i18n.t('Show all ({{COUNT}} characters)', {
COUNT: rawContent.length.toLocaleString()
})}
</button>
{/if}
{:else}
<pre class="text-sm dark:text-gray-400 whitespace-pre-line">{rawContent}</pre>
{/if}
{/if}
{:else}
<pre class="text-sm dark:text-gray-400 whitespace-pre-line">{rawContent}</pre>
{/if}
{/if}
</div>
</div>
{/each}
+34 -10
View File
@@ -371,17 +371,29 @@
{:else if selectedTab === ''}
{#if item?.file?.data}
{@const rawContent = (item?.file?.data?.content ?? '').trim() || 'No content'}
{@const isTruncated = ($settings?.renderMarkdownInPreviews ?? true) && rawContent.length > CONTENT_PREVIEW_LIMIT && !expandedContent}
{@const isTruncated =
($settings?.renderMarkdownInPreviews ?? true) &&
rawContent.length > CONTENT_PREVIEW_LIMIT &&
!expandedContent}
{#if $settings?.renderMarkdownInPreviews ?? true}
<div class="max-h-96 overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full">
<Markdown content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent} id="file-preview" />
<div
class="max-h-96 overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full"
>
<Markdown
content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent}
id="file-preview"
/>
</div>
{#if isTruncated}
<button
class="mt-1 text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
on:click={() => { expandedContent = true; }}
on:click={() => {
expandedContent = true;
}}
>
{$i18n.t('Show all ({{COUNT}} characters)', { COUNT: rawContent.length.toLocaleString() })}
{$i18n.t('Show all ({{COUNT}} characters)', {
COUNT: rawContent.length.toLocaleString()
})}
</button>
{/if}
{:else}
@@ -391,17 +403,29 @@
{/if}
{:else if item?.content}
{@const rawContent = (item?.content ?? '').trim() || 'No content'}
{@const isTruncated = ($settings?.renderMarkdownInPreviews ?? true) && rawContent.length > CONTENT_PREVIEW_LIMIT && !expandedContent}
{@const isTruncated =
($settings?.renderMarkdownInPreviews ?? true) &&
rawContent.length > CONTENT_PREVIEW_LIMIT &&
!expandedContent}
{#if $settings?.renderMarkdownInPreviews ?? true}
<div class="max-h-96 overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full">
<Markdown content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent} id="file-preview-content" />
<div
class="max-h-96 overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full"
>
<Markdown
content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent}
id="file-preview-content"
/>
</div>
{#if isTruncated}
<button
class="mt-1 text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
on:click={() => { expandedContent = true; }}
on:click={() => {
expandedContent = true;
}}
>
{$i18n.t('Show all ({{COUNT}} characters)', { COUNT: rawContent.length.toLocaleString() })}
{$i18n.t('Show all ({{COUNT}} characters)', {
COUNT: rawContent.length.toLocaleString()
})}
</button>
{/if}
{:else}