editor: skip ignoreEdit updates before scheduling save

Signed-off-by: kashaf-ansari-dev <kashafansari3108@gmail.com>
This commit is contained in:
kashaf-ansari-dev
2026-07-29 10:31:36 +05:00
committed by Ammar Ahmed
parent 41cdc882c9
commit 02c60d14c7

View File

@@ -216,8 +216,7 @@ export function useEditorController({
return;
}
const timerPending = !!timers.current.change;
if (ignoreEdit && timerPending) {
if (ignoreEdit) {
logger("info", "Ignoring ignoreEdit update, a save is already pending");
return;
}
@@ -227,8 +226,8 @@ export function useEditorController({
const noteId = tabRef.current.session?.noteId;
post(EditorEvents.contentchange, undefined, tabId, noteId);
if (!editor) return;
if (timerPending) {
clearTimeout(timers.current?.change as any);
if (typeof timers.current.change === "number") {
clearTimeout(timers.current?.change);
}
timers.current.change = setTimeout(async () => {
@@ -246,7 +245,6 @@ export function useEditorController({
const editedAt = Date.now();
htmlContentRef.current = editor.getHTML();
timers.current.change = null;
const params = [
{