From 49f9d872f4c49d06bb9582361cdd7361214102ea Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 3 May 2021 17:24:02 +0200 Subject: [PATCH] Fix OnlyOffice issues when reconnecting --- www/common/onlyoffice/inner.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 6ae9a2a27..f87cff136 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -2668,16 +2668,22 @@ define([ } + // Only execute the following code the first time we call onReady + if (!firstReady) { + setMyId(); + oldHashes = JSON.parse(JSON.stringify(content.hashes)); + initializing = false; + return void setEditable(!readOnly); + } + firstReady = false; + + var useNewDefault = content.version && content.version >= 2; openRtChannel(function () { setMyId(); oldHashes = JSON.parse(JSON.stringify(content.hashes)); initializing = false; - // Only execute the following code the first time we call onReady - if (!firstReady) { return void setEditable(!readOnly); } - firstReady = false; - common.openPadChat(APP.onLocal); if (!readOnly) { @@ -2836,10 +2842,12 @@ define([ common.gotoURL(); }); } - setEditable(true); + //setEditable(true); + try { getEditor().asc_setViewMode(false); } catch (e) {} offline = false; } else { - setEditable(false); + try { getEditor().asc_setViewMode(true); } catch (e) {} + //setEditable(false); offline = true; UI.findOKButton().click(); UIElements.disconnectAlert();