mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-08-29 10:09:26 +02:00
editor: skip ignoreEdit updates before scheduling save
Signed-off-by: kashaf-ansari-dev <kashafansari3108@gmail.com>
This commit is contained in:
committed by
Ammar Ahmed
parent
41cdc882c9
commit
02c60d14c7
@@ -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 = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user