chore: format
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user