Track the inUndoState

This commit is contained in:
the-djmaze 2023-12-05 16:18:17 +01:00
parent 7e2cc69a23
commit 5d6fb0c705
2 changed files with 5 additions and 4 deletions

View file

@ -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) {

View file

@ -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);