[DE] Fix disable for several actions

This commit is contained in:
Julia Radzhabova 2021-06-30 15:19:45 +03:00
parent 68fc002dc3
commit 6506146eab
6 changed files with 34 additions and 16 deletions

View file

@ -69,7 +69,7 @@ Common.IrregularStack = function(config) {
} }
var _get = function(obj) { var _get = function(obj) {
var index = _indexOf(obj, _weakCompare); var index = (typeof obj === 'object')? _indexOf(obj, _weakCompare) : obj;
if (index != -1) if (index != -1)
return _stack[index]; return _stack[index];
return undefined; return undefined;
@ -79,10 +79,15 @@ Common.IrregularStack = function(config) {
return !(_indexOf(obj, _strongCompare) < 0); return !(_indexOf(obj, _strongCompare) < 0);
} }
var _length = function() {
return _stack.length;
}
return { return {
push: _push, push: _push,
pop: _pop, pop: _pop,
get: _get, get: _get,
exist: _exist exist: _exist,
length: _length
} }
}; };

View file

@ -747,7 +747,7 @@ define([
documentHolder: true, documentHolder: true,
toolbar: true, toolbar: true,
plugins: true plugins: true
}); }, 'review');
if (this.view) { if (this.view) {
this.view.$el.find('.no-group-mask.review').css('opacity', 1); this.view.$el.find('.no-group-mask.review').css('opacity', 1);

View file

@ -272,7 +272,7 @@ define([
documentHolder: true, documentHolder: true,
toolbar: true, toolbar: true,
plugins: false plugins: false
}); }, 'forms');
if (this.view) if (this.view)
this.view.$el.find('.no-group-mask.form-view').css('opacity', 1); this.view.$el.find('.no-group-mask.form-view').css('opacity', 1);
} }

View file

@ -161,6 +161,11 @@ define([
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;} weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
}); });
this.stackDisableActions = new Common.IrregularStack({
strongCompare : function(obj1, obj2){return obj1.type === obj2.type;},
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
});
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false, isDocModified: false}; this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false, isDocModified: false};
this.languages = null; this.languages = null;
@ -725,20 +730,24 @@ define([
documentHolder: true, documentHolder: true,
toolbar: true, toolbar: true,
plugins: false plugins: false
}); }, temp ? 'reconnect' : 'disconnect');
}, },
onEditingDisable: function(disable, options) { onEditingDisable: function(disable, options, type) {
var app = this.getApplication(); var app = this.getApplication();
if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') { var action = {type: type, disable: disable, options: options};
if (options.rightMenu) { if (disable && !this.stackDisableActions.get({type: type}))
options.rightMenu.clear && app.getController('RightMenu').getView('RightMenu').clearSelection(); this.stackDisableActions.push(action);
options.rightMenu.disable && app.getController('RightMenu').SetDisabled(disable, options.allowMerge, options.allowSignature); !disable && this.stackDisableActions.pop({type: type});
} var prev_options = !disable && (this.stackDisableActions.length()>0) ? this.stackDisableActions.get(this.stackDisableActions.length()-1) : null;
if (options.statusBar) {
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable); if (options.rightMenu && app.getController('RightMenu')) {
} options.rightMenu.clear && app.getController('RightMenu').getView('RightMenu').clearSelection();
options.rightMenu.disable && app.getController('RightMenu').SetDisabled(disable, options.allowMerge, options.allowSignature);
}
if (options.statusBar) {
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
} }
if (options.review) { if (options.review) {
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable); app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
@ -774,6 +783,10 @@ define([
if (options.plugins) { if (options.plugins) {
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable); app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
} }
if (prev_options) {
this.onEditingDisable(prev_options.disable, prev_options.options, prev_options.type);
}
}, },
onRequestClose: function() { onRequestClose: function() {

View file

@ -818,7 +818,7 @@ define([
documentHolder: true, documentHolder: true,
toolbar: true, toolbar: true,
plugins: false plugins: false
}); }, 'mailmerge');
this.lockControls(DE.enumLockMM.preview, disable, {array: [this.btnInsField, this.btnEditData]}); this.lockControls(DE.enumLockMM.preview, disable, {array: [this.btnInsField, this.btnEditData]});
}, },

View file

@ -412,7 +412,7 @@ define([
documentHolder: true, documentHolder: true,
toolbar: true, toolbar: true,
plugins: false plugins: false
}); }, 'signature');
} }
}, },