Add customization->help option for show/hide help (default is true)

This commit is contained in:
Julia Radzhabova 2018-04-19 17:26:42 +03:00
parent 19ce255bdf
commit f964680eb4
11 changed files with 57 additions and 31 deletions

View file

@ -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

View file

@ -119,7 +119,8 @@
autosave: true,
forcesave: false,
commentAuthorOnly: false,
showReviewChanges: false
showReviewChanges: false,
help: true
},
plugins: {
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],

View file

@ -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');
}

View file

@ -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 =

View file

@ -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']();
},

View file

@ -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();

View file

@ -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)

View file

@ -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) {

View file

@ -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');

View file

@ -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();

View file

@ -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) {