[SSE] Refactoring disabled panels

This commit is contained in:
Julia Radzhabova 2021-06-28 20:12:31 +03:00
parent b6b8123881
commit 8e3bc0869a
7 changed files with 32 additions and 24 deletions

View file

@ -323,7 +323,7 @@ define([
this.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager);
},
disableEditing: function(disabled) {
SetDisabled: function(disabled) {
this.editor.$btnfunc[!disabled?'removeClass':'addClass']('disabled');
this.editor.btnNamedRanges.setVisible(!disabled);
},

View file

@ -188,13 +188,21 @@ define([
return this;
},
disableEditing: function(disabled) {
this.leftMenu.btnComments.setDisabled(disabled);
this.leftMenu.btnChat.setDisabled(disabled);
this.leftMenu.btnPlugins.setDisabled(disabled);
this.leftMenu.btnSpellcheck.setDisabled(disabled);
SetDisabled: function(disable, disableFileMenu) {
this.mode.isEdit = !disable;
if (disable) this.leftMenu.close();
this.leftMenu.getMenu('file').disableEditing(disabled);
/** coauthoring begin **/
this.leftMenu.btnComments.setDisabled(disable);
var comments = this.getApplication().getController('Common.Controllers.Comments');
if (comments)
comments.setPreviewMode(disable);
this.setPreviewMode(disable);
this.leftMenu.btnChat.setDisabled(disable);
/** coauthoring end **/
this.leftMenu.btnPlugins.setDisabled(disable);
this.leftMenu.btnSpellcheck.setDisabled(disable);
if (disableFileMenu) this.leftMenu.getMenu('file').SetDisabled(disable);
},
createDelayedElements: function() {

View file

@ -1036,8 +1036,14 @@ define([
var app = this.getApplication();
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') {
app.getController('RightMenu').getView('RightMenu').clearSelection();
app.getController('Toolbar').DisableToolbar(disable);
app.getController('RightMenu').SetDisabled(disable, false);
app.getController('Toolbar').DisableToolbar(disable,disable);
app.getController('Statusbar').SetDisabled(disable);
}
app.getController('LeftMenu').SetDisabled(disable, true);
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
app.getController('Viewport').SetDisabled(disable);
app.getController('CellEditor').SetDisabled(disable);
},
onOpenDocument: function(progress) {
@ -2439,16 +2445,11 @@ define([
disablefunc: function (disable) {
me.disableEditing(disable);
var app = me.getApplication();
app.getController('Toolbar').DisableToolbar(disable,disable);
app.getController('RightMenu').SetDisabled(disable, true);
app.getController('Statusbar').SetDisabled(disable);
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
app.getController('DocumentHolder').SetDisabled(disable);
var leftMenu = app.getController('LeftMenu');
leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
leftMenu.setPreviewMode(disable);
leftMenu.disableEditing(disable);
app.getController('CellEditor').disableEditing(disable);
app.getController('Viewport').disableEditing(disable);
var comments = app.getController('Common.Controllers.Comments');
if (comments) comments.setPreviewMode(disable);
}});

View file

@ -505,7 +505,7 @@ define([
}
},
disableEditing: function (disabled) {
SetDisabled: function (disabled) {
this.viewmode = disabled;
this.header.mnuitemHideHeadings.setDisabled(disabled);
this.header.mnuitemHideGridlines.setDisabled(disabled);

View file

@ -328,8 +328,7 @@ define([
}
if ( this.mode.disableEditing != undefined ) {
this.panels['opts'].disableEditing(this.mode.disableEditing);
this.miProtect.setDisabled(this.mode.disableEditing);
this.panels['opts'].SetDisabled(this.mode.disableEditing);
delete this.mode.disableEditing;
}
},
@ -425,13 +424,13 @@ define([
}
},
disableEditing: function(disabled) {
SetDisabled: function(disable) {
if ( !this.panels ) {
this.mode.disableEditing = disabled;
this.mode.disableEditing = disable;
} else {
this.panels['opts'].disableEditing(disabled);
this.miProtect.setDisabled(disabled);
this.panels['opts'].SetDisabled(disable);
}
var _btn_save = this.getButton('save'),
_btn_rename = this.getButton('rename'),
_btn_protect = this.getButton('protect');

View file

@ -261,7 +261,7 @@ define([
this.spellcheckSettings && this.spellcheckSettings.setApi(api);
},
disableEditing: function(disabled) {
SetDisabled: function(disabled) {
if ( disabled ) {
$(this.viewSettingsPicker.dataViewItems[1].el).hide();
$(this.viewSettingsPicker.dataViewItems[2].el).hide();

View file

@ -478,7 +478,7 @@ define([
this.mode = _.extend({}, this.mode, mode);
// this.$el.find('.el-edit')[mode.isEdit?'show':'hide']();
this.btnAddWorksheet.setVisible(this.mode.isEdit);
this.btnAddWorksheet.setDisabled(this.mode.isDisconnected);
this.btnAddWorksheet.setDisabled(this.mode.isDisconnected || this.api && (this.api.asc_isWorkbookLocked() || this.api.isCellEdited) || this.rangeSelectionMode!=Asc.c_oAscSelectionDialogType.None);
this.updateTabbarBorders();
},