diff options
-rw-r--r-- | public/js/index.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/public/js/index.js b/public/js/index.js index 183a81c8..9c77ba8d 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -2653,7 +2653,8 @@ 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 || (cmClient.revision !== obj.revision && Object.keys(cmClient.state).length <= 0))) || obj.force; + var havePendingOperation = cmClient && Object.keys(cmClient.state).length > 0; + var setDoc = !cmClient || (cmClient && (cmClient.revision === -1 || (cmClient.revision !== obj.revision && !havePendingOperation))) || obj.force; saveInfo(); if (setDoc && bodyMismatch) { @@ -2687,6 +2688,8 @@ socket.on('doc', function (obj) { cmClient.setState(new ot.Client.Synchronized()); cmClient.initializeClientList(); cmClient.initializeClients(obj.clients); + } else if (havePendingOperation) { + cmClient.serverReconnect(); } if (setDoc && bodyMismatch) { |