mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
Changeset: Add new Builder.prototype.build()
method
This commit is contained in:
parent
a1c4382386
commit
29da9815ae
1 changed files with 15 additions and 3 deletions
|
@ -1988,14 +1988,26 @@ class Builder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
toString() {
|
/**
|
||||||
|
* @returns {Changeset}
|
||||||
|
*/
|
||||||
|
build() {
|
||||||
/** @type {number} */
|
/** @type {number} */
|
||||||
let lengthChange;
|
let lengthChange;
|
||||||
const serializedOps = exports.serializeOps((function* () {
|
const serializedOps = exports.serializeOps((function* () {
|
||||||
lengthChange = yield* exports.canonicalizeOps(this._ops, true);
|
lengthChange = yield* exports.canonicalizeOps(this._ops, true);
|
||||||
}).call(this));
|
}).call(this));
|
||||||
const newLen = this._oldLen + lengthChange;
|
return {
|
||||||
return exports.pack(this._oldLen, newLen, serializedOps, this._charBank.toString());
|
oldLen: this._oldLen,
|
||||||
|
newLen: this._oldLen + lengthChange,
|
||||||
|
ops: serializedOps,
|
||||||
|
charBank: this._charBank.toString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
toString() {
|
||||||
|
const {oldLen, newLen, ops, charBank} = this.build();
|
||||||
|
return exports.pack(oldLen, newLen, ops, charBank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Builder = Builder;
|
exports.Builder = Builder;
|
||||||
|
|
Loading…
Reference in a new issue