diff --git a/apps/common/IrregularStack.js b/apps/common/IrregularStack.js index 4092f0358..4f5f2ee2d 100644 --- a/apps/common/IrregularStack.js +++ b/apps/common/IrregularStack.js @@ -69,7 +69,7 @@ Common.IrregularStack = function(config) { } var _get = function(obj) { - var index = _indexOf(obj, _weakCompare); + var index = (typeof obj === 'object')? _indexOf(obj, _weakCompare) : obj; if (index != -1) return _stack[index]; return undefined; @@ -79,10 +79,15 @@ Common.IrregularStack = function(config) { return !(_indexOf(obj, _strongCompare) < 0); } + var _length = function() { + return _stack.length; + } + return { push: _push, pop: _pop, get: _get, - exist: _exist + exist: _exist, + length: _length } }; \ No newline at end of file diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 9a1b9cc68..6b6312256 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -747,7 +747,7 @@ define([ documentHolder: true, toolbar: true, plugins: true - }); + }, 'review'); if (this.view) { this.view.$el.find('.no-group-mask.review').css('opacity', 1); diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index 3dfb8c9f8..da26708e6 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -272,7 +272,7 @@ define([ documentHolder: true, toolbar: true, plugins: false - }); + }, 'forms'); if (this.view) this.view.$el.find('.no-group-mask.form-view').css('opacity', 1); } diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index e008f0e5e..e9e8e4a79 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -161,6 +161,11 @@ define([ 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.languages = null; @@ -725,20 +730,24 @@ define([ documentHolder: true, toolbar: true, plugins: false - }); + }, temp ? 'reconnect' : 'disconnect'); }, - onEditingDisable: function(disable, options) { + onEditingDisable: function(disable, options, type) { var app = this.getApplication(); - if (this.appOptions.canEdit && this.editorConfig.mode !== 'view') { - if (options.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); - } + var action = {type: type, disable: disable, options: options}; + if (disable && !this.stackDisableActions.get({type: type})) + this.stackDisableActions.push(action); + !disable && this.stackDisableActions.pop({type: type}); + var prev_options = !disable && (this.stackDisableActions.length()>0) ? this.stackDisableActions.get(this.stackDisableActions.length()-1) : null; + + 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) { app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable); @@ -774,6 +783,10 @@ define([ if (options.plugins) { 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() { diff --git a/apps/documenteditor/main/app/view/MailMergeSettings.js b/apps/documenteditor/main/app/view/MailMergeSettings.js index f3f194786..7ccc75536 100644 --- a/apps/documenteditor/main/app/view/MailMergeSettings.js +++ b/apps/documenteditor/main/app/view/MailMergeSettings.js @@ -818,7 +818,7 @@ define([ documentHolder: true, toolbar: true, plugins: false - }); + }, 'mailmerge'); this.lockControls(DE.enumLockMM.preview, disable, {array: [this.btnInsField, this.btnEditData]}); }, diff --git a/apps/documenteditor/main/app/view/SignatureSettings.js b/apps/documenteditor/main/app/view/SignatureSettings.js index 2ef9ec848..c489c8e13 100644 --- a/apps/documenteditor/main/app/view/SignatureSettings.js +++ b/apps/documenteditor/main/app/view/SignatureSettings.js @@ -412,7 +412,7 @@ define([ documentHolder: true, toolbar: true, plugins: false - }); + }, 'signature'); } },