From a4d1b47a4ca8036936bd2a441b1a177c8debfc3f Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 24 Mar 2020 12:40:13 +0100 Subject: [PATCH] Fix 'readonly' mode after disconnection in onlyoffice --- www/common/onlyoffice/inner.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index f9ed15f60..5ac3da269 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -104,10 +104,14 @@ define([ return metadataMgr.getNetfluxId() + '-' + privateData.clientId; }; + var getEditor = function () { + return window.frames[0].editor || window.frames[0].editorCell; + }; + var setEditable = function (state) { $('#cp-app-oo-editor').find('#cp-app-oo-offline').remove(); try { - window.frames[0].editor.asc_setViewMode(!state); + getEditor().asc_setViewMode(!state); //window.frames[0].editor.setViewModeDisconnect(true); } catch (e) {} if (!state && !readOnly) { @@ -241,10 +245,6 @@ define([ cpIndex: 0 }; - var getEditor = function () { - return window.frames[0].editor || window.frames[0].editorCell; - }; - var getContent = function () { try { return getEditor().asc_nativeGetFile(); @@ -847,7 +847,7 @@ define([ "id": String(myOOId), //"c0c3bf82-20d7-4663-bf6d-7fa39c598b1d", "firstname": metadataMgr.getUserData().name || Messages.anonymous, }, - "mode": readOnly || lock ? "view" : "edit", + "mode": lock ? "view" : "edit", "lang": (navigator.language || navigator.userLanguage || '').slice(0,2) }, "events": {