changeset.js: do not lose sync in the timeslider if another user deletes text

If a user deleted text/attributes while another one had the timeslider open,
the timeslider lost sync and spit out errors.

Fixes #3932.
pull/3951/head
John McLear 2020-04-24 18:11:36 +00:00 committed by muxator
parent 7bdc9d8a57
commit 452db293b0
1 changed files with 11 additions and 1 deletions

View File

@ -1529,7 +1529,17 @@ exports.moveOpsToNewPool = function (cs, oldPool, newPool) {
return upToDollar.replace(/\*([0-9a-z]+)/g, function (_, a) {
var oldNum = exports.parseNum(a);
var pair = oldPool.getAttrib(oldNum);
if(!pair) exports.error('Can\'t copy unknown attrib (reference attrib string to non-existant pool entry). Inconsistent attrib state!');
/*
* Setting an empty pair. Required for when delete pad contents / attributes
* while another user has the timeslider open.
*
* Fixes https://github.com/ether/etherpad-lite/issues/3932
*/
if (!pair) {
pair = [];
}
var newNum = newPool.putAttrib(pair);
return '*' + exports.numToString(newNum);
}) + fromDollar;