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}