mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Changeset: Require Op opcode and attribs to be strings
This commit is contained in:
parent
0ae8fb1441
commit
9c17b03660
2 changed files with 5 additions and 3 deletions
|
@ -488,9 +488,11 @@ exports.opAssembler = () => {
|
||||||
* @param {Op} op - Operation to add. Ownership remains with the caller.
|
* @param {Op} op - Operation to add. Ownership remains with the caller.
|
||||||
*/
|
*/
|
||||||
const append = (op) => {
|
const append = (op) => {
|
||||||
if (op.attribs != null) serialized += op.attribs;
|
if (!op.opcode) throw new TypeError('null op');
|
||||||
|
if (typeof op.attribs !== 'string') throw new TypeError('attribs must be a string');
|
||||||
|
serialized += op.attribs;
|
||||||
if (op.lines) serialized += `|${exports.numToString(op.lines)}`;
|
if (op.lines) serialized += `|${exports.numToString(op.lines)}`;
|
||||||
if (op.opcode != null) serialized += op.opcode;
|
serialized += op.opcode;
|
||||||
serialized += exports.numToString(op.chars);
|
serialized += exports.numToString(op.chars);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author)
|
||||||
attribsBuilder = Changeset.smartOpAssembler();
|
attribsBuilder = Changeset.smartOpAssembler();
|
||||||
},
|
},
|
||||||
textOfLine: (i) => textArray[i],
|
textOfLine: (i) => textArray[i],
|
||||||
appendText: (txt, attrString) => {
|
appendText: (txt, attrString = '') => {
|
||||||
textArray[textArray.length - 1] += txt;
|
textArray[textArray.length - 1] += txt;
|
||||||
op.attribs = attrString;
|
op.attribs = attrString;
|
||||||
op.chars = txt.length;
|
op.chars = txt.length;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue