mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
Changeset: Move changeset logic to a new Changeset
class
This commit is contained in:
parent
a470253779
commit
b718d88157
11 changed files with 193 additions and 127 deletions
|
@ -538,8 +538,8 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
lengthChange = yield* Changeset.canonicalizeOps(ops, false);
|
||||
})());
|
||||
const newLen = oldLen + lengthChange;
|
||||
const changeset =
|
||||
Changeset.checkRep(Changeset.pack(oldLen, newLen, serializedOps, atext.text.slice(0, -1)));
|
||||
const changeset = Changeset.pack(oldLen, newLen, serializedOps, atext.text.slice(0, -1));
|
||||
Changeset.unpack(changeset).validate();
|
||||
performDocumentApplyChangeset(changeset);
|
||||
|
||||
performSelectionChange(
|
||||
|
@ -1447,7 +1447,7 @@ function Ace2Inner(editorInfo, cssManagers) {
|
|||
};
|
||||
|
||||
const doRepApplyChangeset = (changes, insertsAfterSelection) => {
|
||||
Changeset.checkRep(changes);
|
||||
Changeset.unpack(changes).validate();
|
||||
|
||||
if (Changeset.oldLen(changes) !== rep.alltext.length) {
|
||||
const errMsg = `${Changeset.oldLen(changes)}/${rep.alltext.length}`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue