Fix socket io doc event should setDoc when revision mismatch and no outstanding operation

This commit is contained in:
Wu Cheng-Han 2016-10-23 20:17:33 +08:00
parent 5ad7d61499
commit 3db1214ecf

View file

@ -2651,7 +2651,7 @@ socket.on('doc', function (obj) {
obj = JSON.parse(obj);
var body = obj.str;
var bodyMismatch = editor.getValue() !== body;
var setDoc = !cmClient || (cmClient && cmClient.revision === -1) || obj.force;
var setDoc = !cmClient || (cmClient && (cmClient.revision === -1 || (cmClient.revision !== obj.revision && Object.keys(cmClient.state).length <= 0))) || obj.force;
saveInfo();
if (setDoc && bodyMismatch) {