From f964680eb4c3752277e9c9aba43a506fcc955b3a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 19 Apr 2018 17:26:42 +0300 Subject: [PATCH] Add customization->help option for show/hide help (default is true) --- CHANGELOG.md | 1 + apps/api/documents/api.js | 3 ++- .../main/app/controller/LeftMenu.js | 2 +- .../main/app/controller/Main.js | 1 + apps/documenteditor/main/app/view/FileMenu.js | 25 ++++++++++++------- .../main/app/controller/LeftMenu.js | 2 +- .../main/app/controller/Main.js | 1 + .../main/app/view/FileMenu.js | 25 ++++++++++++------- .../main/app/controller/LeftMenu.js | 2 +- .../main/app/controller/Main.js | 1 + .../main/app/view/FileMenu.js | 25 ++++++++++++------- 11 files changed, 57 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea959a923..035682adf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### All Editors * Customize initial zoom for the embedded editors * Replace image from context menu (bug #11493) +* Customize availability of help in the editor ### Document Editor * Create and manage bookmarks diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index dd8e43610..8e9bbeee4 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -119,7 +119,8 @@ autosave: true, forcesave: false, commentAuthorOnly: false, - showReviewChanges: false + showReviewChanges: false, + help: true }, plugins: { autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 2be1b2a1c..77d1a40d3 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -634,7 +634,7 @@ define([ } return false; case 'help': - if ( this.mode.isEdit ) { // TODO: unlock 'help' for 'view' mode + if ( this.mode.isEdit && this.mode.canHelp ) { // TODO: unlock 'help' for 'view' mode Common.UI.Menu.Manager.hideAll(); this.leftMenu.showMenu('file:help'); } diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index a248f03e4..d6becf0b2 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1089,6 +1089,7 @@ define([ this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); this.appOptions.trialMode = params.asc_getLicenseMode(); this.appOptions.canProtect = this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport(); + this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); if ( this.appOptions.isLightVersion ) { this.appOptions.canUseHistory = diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index d6e490985..03eb65487 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -161,6 +161,13 @@ define([ canFocused: false }); + this.miHelp = new Common.UI.MenuItem({ + el : $('#fm-btn-help',this.el), + action : 'help', + caption : this.btnHelpCaption, + canFocused: false + }); + this.items = []; this.items.push( new Common.UI.MenuItem({ @@ -192,12 +199,7 @@ define([ caption : this.btnSettingsCaption, canFocused: false }), - new Common.UI.MenuItem({ - el : $('#fm-btn-help',this.el), - action : 'help', - caption : this.btnHelpCaption, - canFocused: false - }), + this.miHelp, new Common.UI.MenuItem({ el : $('#fm-btn-back',this.el), action : 'exit', @@ -211,8 +213,7 @@ define([ // 'saveas' : (new DE.Views.FileMenuPanels.ViewSaveAs({menu:me})).render(), 'opts' : (new DE.Views.FileMenuPanels.Settings({menu:me})).render(), 'info' : (new DE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(), - 'rights' : (new DE.Views.FileMenuPanels.DocumentRights({menu:me})).render(), - 'help' : (new DE.Views.FileMenuPanels.Help({menu:me})).render() + 'rights' : (new DE.Views.FileMenuPanels.DocumentRights({menu:me})).render() }; me.$el.find('.content-box').hide(); @@ -260,6 +261,9 @@ define([ (this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 || this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide'](); + this.miHelp[this.mode.canHelp ?'show':'hide'](); + this.miHelp.$el.prev()[this.mode.canHelp ?'show':'hide'](); + this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() : this.$el.find('#fm-btn-back').hide().prev().hide(); @@ -291,7 +295,10 @@ define([ } else if (this.mode.canDownloadOrigin) $('a',this.miDownload.$el).text(this.textDownload); - this.panels['help'].setLangConfig(this.mode.lang); + if (this.mode.canHelp) { + this.panels['help'] = ((new DE.Views.FileMenuPanels.Help({menu: this})).render()); + this.panels['help'].setLangConfig(this.mode.lang); + } this.miHistory[this.mode.canUseHistory&&!this.mode.isDisconnected?'show':'hide'](); }, diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 90c984e58..174054b64 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -489,7 +489,7 @@ define([ } return false; case 'help': - if ( this.mode.isEdit ) { // TODO: unlock 'help' panel for 'view' mode + if ( this.mode.isEdit && this.mode.canHelp ) { // TODO: unlock 'help' panel for 'view' mode if (!previewPanel || !previewPanel.isVisible()){ Common.UI.Menu.Manager.hideAll(); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 3c8331756..8baae7e8a 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -853,6 +853,7 @@ define([ this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); this.appOptions.trialMode = params.asc_getLicenseMode(); this.appOptions.canProtect = this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport(); + this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object'); if (this.appOptions.canBranding) diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index f1eff56e8..88afa3a0b 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -157,6 +157,13 @@ define([ canFocused: false }); + this.miHelp = new Common.UI.MenuItem({ + el : $('#fm-btn-help',this.el), + action : 'help', + caption : this.btnHelpCaption, + canFocused: false + }); + this.items = []; this.items.push( new Common.UI.MenuItem({ @@ -187,12 +194,7 @@ define([ caption : this.btnSettingsCaption, canFocused: false }), - new Common.UI.MenuItem({ - el : $('#fm-btn-help',this.el), - action : 'help', - caption : this.btnHelpCaption, - canFocused: false - }), + this.miHelp, new Common.UI.MenuItem({ el : $('#fm-btn-back',this.el), action : 'exit', @@ -206,8 +208,7 @@ define([ 'saveas' : (new PE.Views.FileMenuPanels.ViewSaveAs({menu:me})).render(), 'opts' : (new PE.Views.FileMenuPanels.Settings({menu:me})).render(), 'info' : (new PE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(), - 'rights' : (new PE.Views.FileMenuPanels.DocumentRights({menu:me})).render(), - 'help' : (new PE.Views.FileMenuPanels.Help({menu:me})).render() + 'rights' : (new PE.Views.FileMenuPanels.DocumentRights({menu:me})).render() }; me.$el.find('.content-box').hide(); @@ -258,6 +259,9 @@ define([ this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() : this.$el.find('#fm-btn-back').hide().prev().hide(); + this.miHelp[this.mode.canHelp ?'show':'hide'](); + this.miHelp.$el.prev()[this.mode.canHelp ?'show':'hide'](); + this.panels['opts'].setMode(this.mode); this.panels['info'].setMode(this.mode).updateInfo(this.document); this.panels['rights'].setMode(this.mode).updateInfo(this.document); @@ -283,7 +287,10 @@ define([ } } - this.panels['help'].setLangConfig(this.mode.lang); + if (this.mode.canHelp) { + this.panels['help'] = ((new PE.Views.FileMenuPanels.Help({menu: this})).render()); + this.panels['help'].setLangConfig(this.mode.lang); + } }, setMode: function(mode, delay) { diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index b7d2a778c..8694f3e1a 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -693,7 +693,7 @@ define([ } return false; case 'help': - if ( this.mode.isEdit ) { // TODO: unlock 'help' panel for 'view' mode + if ( this.mode.isEdit && this.mode.canHelp ) { // TODO: unlock 'help' panel for 'view' mode Common.UI.Menu.Manager.hideAll(); this.api.asc_closeCellEditor(); this.leftMenu.showMenu('file:help'); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 4866758b8..1af7a4b8b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -897,6 +897,7 @@ define([ (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave); this.appOptions.forcesave = this.appOptions.canForcesave; this.appOptions.canEditComments= this.appOptions.isOffline || !(typeof (this.editorConfig.customization) == 'object' && this.editorConfig.customization.commentAuthorOnly); + this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); this.applyModeCommonElements(); this.applyModeEditorElements(); diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index d30d413e3..c00b31a93 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -151,6 +151,13 @@ define([ canFocused: false }); + this.miHelp = new Common.UI.MenuItem({ + el : $('#fm-btn-help',this.el), + action : 'help', + caption : this.btnHelpCaption, + canFocused: false + }); + this.items = []; this.items.push( new Common.UI.MenuItem({ @@ -176,12 +183,7 @@ define([ }), this.miAccess, this.miSettings, - new Common.UI.MenuItem({ - el : $('#fm-btn-help',this.el), - action : 'help', - caption : this.btnHelpCaption, - canFocused: false - }), + this.miHelp, new Common.UI.MenuItem({ el : $('#fm-btn-back',this.el), action : 'exit', @@ -195,8 +197,7 @@ define([ 'saveas' : (new SSE.Views.FileMenuPanels.ViewSaveAs({menu:me})).render(), 'opts' : (new SSE.Views.FileMenuPanels.Settings({menu:me})).render(), 'info' : (new SSE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(), - 'rights' : (new SSE.Views.FileMenuPanels.DocumentRights({menu:me})).render(), - 'help' : (new SSE.Views.FileMenuPanels.Help({menu:me})).render() + 'rights' : (new SSE.Views.FileMenuPanels.DocumentRights({menu:me})).render() }; me.$el.find('.content-box').hide(); @@ -249,6 +250,9 @@ define([ this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() : this.$el.find('#fm-btn-back').hide().prev().hide(); + this.miHelp[this.mode.canHelp ?'show':'hide'](); + this.miHelp.$el.prev()[this.mode.canHelp ?'show':'hide'](); + this.panels['opts'].setMode(this.mode); this.panels['info'].setMode(this.mode).updateInfo(this.document); this.panels['rights'].setMode(this.mode).updateInfo(this.document); @@ -271,7 +275,10 @@ define([ this.panels['protect'].setMode(this.mode); } - this.panels['help'].setLangConfig(this.mode.lang); + if (this.mode.canHelp) { + this.panels['help'] = ((new SSE.Views.FileMenuPanels.Help({menu: this})).render()); + this.panels['help'].setLangConfig(this.mode.lang); + } }, setMode: function(mode, delay) {