summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Cheng-Han2016-10-23 20:17:33 +0800
committerWu Cheng-Han2016-10-23 20:17:33 +0800
commit3db1214ecf22ad54cd0d4bb324c461df252d9a51 (patch)
tree056ec261d1ce3140f7669d9f1d6b489221944628
parent5ad7d614991d1a1b6261bacce224b38f8cd34afc (diff)
Fix socket io doc event should setDoc when revision mismatch and no outstanding operation
-rw-r--r--public/js/index.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 77ab089c..47919d37 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -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) {