From 264f4950bdeb4e15c7b2c8f52f6d3784ef454d06 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 25 May 2020 17:12:12 -0400 Subject: [PATCH] don't show the help menu in embed mode --- www/code/inner.js | 9 +++------ www/common/onlyoffice/inner.js | 16 ++++++++++------ www/kanban/inner.js | 5 ++++- www/pad/inner.js | 4 +++- www/poll/inner.js | 13 +++++++++---- www/slide/inner.js | 5 ++++- www/whiteboard/inner.js | 5 ++++- 7 files changed, 37 insertions(+), 20 deletions(-) diff --git a/www/code/inner.js b/www/code/inner.js index 91ea32a85..56b83b49b 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -418,12 +418,9 @@ define([ var $content = $('#cp-app-code-preview-content'); mkPrintButton(framework, $content, $print); - // XXX don't display the help menu in embed mode? - // metadataMgr.getPrivateData().isEmbed - // do the same in all other apps - // pad, code, oo, slide, poll, whiteboard, kanban - // OR do it in a more generic way... - mkHelpMenu(framework); + if (!privateData.isEmbed) { + mkHelpMenu(framework); + } var evModeChange = Util.mkEvent(); evModeChange.reg(previewPane.modeChange); diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index b5cd86443..262581c2f 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1557,7 +1557,9 @@ define([ }; config.onInit = function (info) { - readOnly = metadataMgr.getPrivateData().readOnly; + var privateData = metadataMgr.getPrivateData(); + + readOnly = privateData.readOnly; Title = common.createTitle({}); @@ -1594,7 +1596,7 @@ define([ var $exportXLSX = common.createButton('export', true, {}, exportXLSXFile); $exportXLSX.appendTo(toolbar.$drawer); - var type = common.getMetadataMgr().getPrivateData().ooType; + var type = privateData.ooType; var accept = [".bin", ".ods", ".xlsx"]; if (type === "ooslide") { accept = ['.bin', '.odp', '.pptx']; @@ -1620,10 +1622,12 @@ define([ }); toolbar.$drawer.append($forget); - var helpMenu = APP.helpMenu = common.createHelpMenu(['beta', 'oo']); - $('#cp-app-oo-editor').prepend(common.getBurnAfterReadingWarning()); - $('#cp-app-oo-editor').prepend(helpMenu.menu); - toolbar.$drawer.append(helpMenu.button); + if (!privateData.isEmbed) { + var helpMenu = APP.helpMenu = common.createHelpMenu(['beta', 'oo']); + $('#cp-app-oo-editor').prepend(common.getBurnAfterReadingWarning()); + $('#cp-app-oo-editor').prepend(helpMenu.menu); + toolbar.$drawer.append(helpMenu.button); + } var $properties = common.createButton('properties', true); toolbar.$drawer.append($properties); diff --git a/www/kanban/inner.js b/www/kanban/inner.js index 4517c7ccb..f5f7c4ac3 100644 --- a/www/kanban/inner.js +++ b/www/kanban/inner.js @@ -962,7 +962,10 @@ define([ var kanban; var $container = $('#cp-app-kanban-content'); - mkHelpMenu(framework); + var privateData = framework._.cpNfInner.metadataMgr.getPrivateData(); + if (!privateData.isEmbed) { + mkHelpMenu(framework); + } if (framework.isReadOnly()) { $container.addClass('cp-app-readonly'); diff --git a/www/pad/inner.js b/www/pad/inner.js index c5bf1a04a..398cc80cb 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -533,7 +533,9 @@ define([ } }; - mkHelpMenu(framework); + if (!privateData.isEmbed) { + mkHelpMenu(framework); + } framework._.sfCommon.getAttribute(['pad', 'width'], function(err, data) { var active = data || typeof(data) === "undefined"; diff --git a/www/poll/inner.js b/www/poll/inner.js index 04287a197..66b3091ed 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -1160,8 +1160,9 @@ define([ var $properties = common.createButton('properties', true); $drawer.append($properties); + var privateData = metadataMgr.getPrivateData(); /* save as template */ - if (!metadataMgr.getPrivateData().isTemplate && common.isLoggedIn()) { + if (!privateData.isTemplate && common.isLoggedIn()) { var templateObj = { rt: info.realtime, getTitle: function () { return metadataMgr.getMetadata().title; } @@ -1177,10 +1178,13 @@ define([ var $export = common.createButton('export', true, {}, exportFile); $drawer.append($export); - var helpMenu = common.createHelpMenu(['poll']); $('#cp-app-poll-form').prepend(common.getBurnAfterReadingWarning()); - $('#cp-app-poll-form').prepend(helpMenu.menu); - $drawer.append(helpMenu.button); + + if (!privateData.isEmbed) { + var helpMenu = common.createHelpMenu(['poll']); + $('#cp-app-poll-form').prepend(helpMenu.menu); + $drawer.append(helpMenu.button); + } if (APP.readOnly) { publish(true); return; } var $publish = common.createButton('', true, { @@ -1283,6 +1287,7 @@ define([ }).nThen(function (/* waitFor */) { Test.registerInner(common.getSframeChannel()); var metadataMgr = common.getMetadataMgr(); + APP.locked = APP.readOnly = metadataMgr.getPrivateData().readOnly; APP.loggedIn = common.isLoggedIn(); APP.SFCommon = common; diff --git a/www/slide/inner.js b/www/slide/inner.js index 90c5b4842..d0c87e940 100644 --- a/www/slide/inner.js +++ b/www/slide/inner.js @@ -499,7 +499,10 @@ define([ mkColorConfiguration(framework, $modal); mkFilePicker(framework, editor); mkSlidePreviewPane(framework, $contentContainer); - mkHelpMenu(framework); + + if (!privateData.isEmbed) { + mkHelpMenu(framework); + } CodeMirror.mkIndentSettings(framework._.cpNfInner.metadataMgr); CodeMirror.init(framework.localChange, framework._.title, framework._.toolbar); diff --git a/www/whiteboard/inner.js b/www/whiteboard/inner.js index 3acbb0042..c0d0e2fe7 100644 --- a/www/whiteboard/inner.js +++ b/www/whiteboard/inner.js @@ -310,7 +310,10 @@ define([ $canvasContainer.find('canvas').css('border-color', bool? 'black': 'red'); }; - mkHelpMenu(framework); + var privateData = metadataMgr.getPrivateData(); + if (!privateData.isEmbed) { + mkHelpMenu(framework); + } mkControls(framework, canvas);