From ca95af082d5e88bffff8f8bb01e6ed045b8cf3df Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 23 Sep 2021 13:27:34 +0200 Subject: [PATCH] Fix scrambled data in sheets on reconnect --- www/common/onlyoffice/inner.js | 8 ++++++++ www/common/outer/onlyoffice.js | 2 ++ 2 files changed, 10 insertions(+) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 591eccc2c..195991db9 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1156,6 +1156,14 @@ define([ }; var handleChanges = function (obj, send) { + if (APP.history) { + send({ + type: "unSaveLock", + index: ooChannel.cpIndex, + time: +new Date() + }); + return; + } // Add a new entry to the pendingChanges object. // If we can't send the patch within 30s, force a page reload var uid = Util.uid(); diff --git a/www/common/outer/onlyoffice.js b/www/common/outer/onlyoffice.js index b5c3e7ba1..dbde5e199 100644 --- a/www/common/outer/onlyoffice.js +++ b/www/common/outer/onlyoffice.js @@ -87,8 +87,10 @@ define([ chan.wc = wc; chan.sendMsg = function (msg, cb) { cb = cb || function () {}; + var hash = msg.slice(0, 64); wc.bcast(msg).then(function () { chan.history.push(msg); + chan.lastKnownHash = hash; cb(); }, function (err) { cb({error: err});