feat: use rich text editor for knowledge file editing

Replace the plain textarea in the knowledge base file editor drawer with the same RichTextInput (TipTap) component already used by the Add Text Content modal. This resolves an inconsistency where creating new text content offered a full WYSIWYG experience with formatting toolbar, headings, bold, lists, and code blocks, while editing existing files was limited to an unstyled textarea. Since all knowledge file content is stored as text regardless of the original file type, there is no reason for the editing experience to differ from the creation experience.
This commit is contained in:
DrMelone 2026-03-17 17:02:57 +01:00
parent f3402d3f1f
commit 09cb1b3ba7

View file

@ -55,6 +55,7 @@
import DropdownOptions from '$lib/components/common/DropdownOptions.svelte';
import Pagination from '$lib/components/common/Pagination.svelte';
import AttachWebpageModal from '$lib/components/chat/MessageInput/AttachWebpageModal.svelte';
import RichTextInput from '$lib/components/common/RichTextInput.svelte';
let largeScreen = true;
@ -1110,13 +1111,14 @@
</div>
{#key selectedFile.id}
<textarea
class="w-full h-full text-sm outline-none resize-none px-3 py-2"
bind:value={selectedFileContent}
disabled={!knowledge?.write_access}
aria-label={$i18n.t('File content')}
placeholder={$i18n.t('Add content here')}
/>
<div class="flex-1 overflow-y-auto px-3 py-2">
<RichTextInput
bind:value={selectedFileContent}
placeholder={$i18n.t('Add content here')}
preserveBreaks={true}
editable={knowledge?.write_access ?? false}
/>
</div>
{/key}
</div>
</div>