From 5d6fb0c7058ea6a4306167292be9727077ab2b4f Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 5 Dec 2023 16:18:17 +0100 Subject: [PATCH] Track the inUndoState --- dev/External/SquireUI.js | 1 + vendors/squire/build/squire-raw.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dev/External/SquireUI.js b/dev/External/SquireUI.js index 16d6f267b..18d1ba0fd 100644 --- a/dev/External/SquireUI.js +++ b/dev/External/SquireUI.js @@ -619,6 +619,7 @@ class SquireUI // Move cursor above signature div.before(br); div.before(br.cloneNode()); +// squire._docWasChanged(); } this._prev_txt_sig = signature; } catch (e) { diff --git a/vendors/squire/build/squire-raw.js b/vendors/squire/build/squire-raw.js index 6de624a64..12e196aa1 100644 --- a/vendors/squire/build/squire-raw.js +++ b/vendors/squire/build/squire-raw.js @@ -2034,14 +2034,14 @@ class EditStack extends Array this[undoIndex] = html; this.index = undoIndex; this.inUndoState = true; + } else { + console.error('EditStack in inUndoState'); } } saveUndoState(range) { let squire = this.squire; - if (range === undefined) { - range = squire.getSelection(); - } + range = range || squire.getSelection(); this.recordUndoState(range, true); squire._getRangeAndRemoveBookmark(range); } @@ -2617,7 +2617,6 @@ class Squire const range = this._getRangeAndRemoveBookmark() || createRange(root.firstElementChild || root, 0); this.saveUndoState(range); this.setRange(range); - return this; } @@ -3148,6 +3147,7 @@ class Squire let node; let nodeAfterSplit; + // TODO: why was _docWasChanged() not triggered? this.editStack.inUndoState && this._docWasChanged(); this._recordUndoState(range); // self._config.addLinks && addLinks(range.startContainer, root);