From baa1a44397b41b1a3282960aabb0c9f801674d61 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 12 Jul 2025 02:17:52 +0400 Subject: [PATCH] refac --- src/lib/components/notes/NoteEditor.svelte | 27 +++++++++++-------- .../components/notes/NoteEditor/Chat.svelte | 9 ++++--- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/lib/components/notes/NoteEditor.svelte b/src/lib/components/notes/NoteEditor.svelte index 9f343f5639..837bef5cf6 100644 --- a/src/lib/components/notes/NoteEditor.svelte +++ b/src/lib/components/notes/NoteEditor.svelte @@ -123,7 +123,7 @@ let dragged = false; let loading = false; - let enhancing = false; + let editing = false; let streaming = false; let stopResponseFlag = false; @@ -190,6 +190,11 @@ return false; } + const onEdited = async () => { + if (!editor) return; + editor.commands.setContent(note.data.content.html); + }; + async function enhanceNoteHandler() { if (selectedModelId === '') { toast.error($i18n.t('Please select a model.')); @@ -205,12 +210,11 @@ return; } - enhancing = true; - - insertNoteVersion(note); + editing = true; await enhanceCompletionHandler(model); + editing = false; - enhancing = false; + onEdited(); versionIdx = null; } @@ -591,7 +595,7 @@ Provide the enhanced notes in markdown format. Use markdown syntax for headings, controller.abort('User: Stop Response'); } - enhancing = false; + editing = false; streaming = false; break; } @@ -930,7 +934,7 @@ Provide the enhanced notes in markdown format. Use markdown syntax for headings, class=" flex-1 w-full h-full overflow-auto px-3.5 pb-20 relative pt-2.5" id="note-content-container" > - {#if enhancing} + {#if editing}
- {#if enhancing} + {#if editing}