From b732666ed090aaf089aa3a31d2787fdb8d6268e6 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 1 Apr 2021 10:34:02 +0200 Subject: [PATCH 1/3] Fix OO migration banner in embed mode --- www/common/onlyoffice/inner.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 2fec3682b..6962d0a73 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -2491,7 +2491,11 @@ define([ APP.onLocal(); } else { msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor); - $(APP.helpMenu.menu).after(msg); + if (APP.helpMenu) { + $(APP.helpMenu.menu).after(msg); + } else { + $('#cp-app-oo-editor').prepend(msg); + } readOnly = true; } } else if (content && content.version <= 3) { // V2 or V3 @@ -2503,7 +2507,11 @@ define([ APP.onLocal(); } else { msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor); - $(APP.helpMenu.menu).after(msg); + if (APP.helpMenu) { + $(APP.helpMenu.menu).after(msg); + } else { + $('#cp-app-oo-editor').prepend(msg); + } readOnly = true; } } From b709b7a31bb39f0a177f3d021ad39a800e879b16 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 1 Apr 2021 10:53:55 +0200 Subject: [PATCH 2/3] Fix OO error modal in switch to read-only --- www/common/onlyoffice/inner.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 6962d0a73..6c2d9332f 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1375,12 +1375,11 @@ define([ return; } - if (lock) { - getEditor().setViewModeDisconnect(); - } else if (readOnly) { + if (lock || readOnly) { try { getEditor().asc_setRestriction(true); } catch (e) {} + //getEditor().setViewModeDisconnect(); // can't be used anymore, display an OO error popup } else { setEditable(true); deleteOfflineLocks(); @@ -1400,7 +1399,6 @@ define([ } } - if (isLockedModal.modal && force) { isLockedModal.modal.closeModal(); delete isLockedModal.modal; @@ -1424,7 +1422,7 @@ define([ } catch (e) {} } - if (APP.migrate && !readOnly) { + if (lock && !readOnly) { onMigrateRdy.fire(); } From 657b9e347b6ebc6890a202d1d9d28f38ead591e4 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 1 Apr 2021 10:58:14 +0200 Subject: [PATCH 3/3] Stop using setViewModeDisconnect in OO --- www/common/onlyoffice/inner.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 6c2d9332f..ef43b06b0 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1350,7 +1350,7 @@ define([ // Migration required but read-only: continue... if (readOnly) { setEditable(true); - getEditor().setViewModeDisconnect(); + try { getEditor().asc_setRestriction(true); } catch (e) {} } else { // No changes after the cp: migrate now onMigrateRdy.fire(); @@ -1376,9 +1376,7 @@ define([ } if (lock || readOnly) { - try { - getEditor().asc_setRestriction(true); - } catch (e) {} + try { getEditor().asc_setRestriction(true); } catch (e) {} //getEditor().setViewModeDisconnect(); // can't be used anymore, display an OO error popup } else { setEditable(true); @@ -1408,7 +1406,8 @@ define([ } if (APP.template) { - getEditor().setViewModeDisconnect(); + try { getEditor().asc_setRestriction(true); } catch (e) {} + //getEditor().setViewModeDisconnect(); UI.removeLoadingScreen(); makeCheckpoint(true); return; @@ -1977,7 +1976,7 @@ define([ UI.removeModals(); UI.confirm(Messages.oo_uploaded, function (yes) { try { - getEditor().setViewModeDisconnect(); + getEditor().asc_setRestriction(true); } catch (e) {} if (!yes) { return; } common.gotoURL(); @@ -2143,7 +2142,9 @@ define([ APP.history = true; APP.template = true; var editor = getEditor(); - if (editor) { editor.setViewModeDisconnect(); } + if (editor) { + try { getEditor().asc_setRestriction(true); } catch (e) {} + } var content = parsed.content; // Get checkpoint @@ -2282,7 +2283,7 @@ define([ var setHistoryMode = function (bool) { if (bool) { APP.history = true; - getEditor().setViewModeDisconnect(); + try { getEditor().asc_setRestriction(true); } catch (e) {} return; } // Cancel button: redraw from lastCp