This commit is contained in:
Ayana H
2025-06-22 04:32:34 -07:00
committed by GitHub

View File

@@ -59,6 +59,9 @@
export let shiftEnter = false; export let shiftEnter = false;
export let largeTextAsFile = false; export let largeTextAsFile = false;
let isUserEditing = false;
let lastSyncedValue = value;
let element; let element;
let editor; let editor;
@@ -256,7 +259,9 @@
} }
if (value !== newValue) { if (value !== newValue) {
isUserEditing = true;
value = newValue; value = newValue;
lastSyncedValue = newValue;
// check if the node is paragraph as well // check if the node is paragraph as well
if (editor.isActive('paragraph')) { if (editor.isActive('paragraph')) {
@@ -409,7 +414,9 @@
}); });
$: if (value !== null && editor) { $: if (value !== null && editor) {
onValueChange(); if (!isUserEditing && value !== lastSyncedValue) {
onValueChange();
}
} }
const onValueChange = () => { const onValueChange = () => {
@@ -447,6 +454,8 @@
); // Update editor content ); // Update editor content
selectTemplate(); selectTemplate();
lastSyncedValue = value;
isUserEditing = false;
} }
} }
} }