From 3db1214ecf22ad54cd0d4bb324c461df252d9a51 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sun, 23 Oct 2016 20:17:33 +0800 Subject: [PATCH] Fix socket io doc event should setDoc when revision mismatch and no outstanding operation --- public/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/index.js b/public/js/index.js index 77ab089c0..47919d37d 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) {