diff --git a/apps/documenteditor/main/app/controller/DocumentHolder.js b/apps/documenteditor/main/app/controller/DocumentHolder.js index 7666117ea8..2b03599cea 100644 --- a/apps/documenteditor/main/app/controller/DocumentHolder.js +++ b/apps/documenteditor/main/app/controller/DocumentHolder.js @@ -336,6 +336,13 @@ define([ } else if (type === Asc.c_oAscTypeSelectElement.Paragraph || type === Asc.c_oAscTypeSelectElement.Table || type === Asc.c_oAscTypeSelectElement.Header) { var value = selectedElements[i].get_ObjectValue(); value && (locked = locked || value.get_Locked()); + } else if (type === Asc.c_oAscTypeSelectElement.UnProtectedRegion) { //(unprotected region) + var value = selectedElements[i].get_ObjectValue(); + me.documentHolder._unprotectedRegion = { + canEditText: value.get_canEditText(), + canEditPara: value.get_canEditPara(), + canInsObject: value.get_canInsObject() + }; } } if (in_equation) { diff --git a/apps/documenteditor/main/app/controller/DocumentHolderExt.js b/apps/documenteditor/main/app/controller/DocumentHolderExt.js index d99115ba6b..997f477d94 100644 --- a/apps/documenteditor/main/app/controller/DocumentHolderExt.js +++ b/apps/documenteditor/main/app/controller/DocumentHolderExt.js @@ -861,7 +861,8 @@ define([], function () { dh.disableSpecialPaste = function() { var pasteContainer = this.documentHolder.cmpEl.find('#special-paste-container'), docProtection = this.documentHolder._docProtection, - disabled = this._isDisabled || docProtection.isReadOnly || docProtection.isCommentsOnly; + unprotectedRegion = this.documentHolder._unprotectedRegion, + disabled = this._isDisabled || docProtection.isReadOnly && !unprotectedRegion.canInsObject || docProtection.isCommentsOnly && !unprotectedRegion.canInsObject; if (pasteContainer.length>0 && pasteContainer.is(':visible')) { this.btnSpecialPaste.setDisabled(!!disabled); @@ -2276,7 +2277,8 @@ define([], function () { dh.disableEquationBar = function() { var eqContainer = this.documentHolder.cmpEl.find('#equation-container'), docProtection = this.documentHolder._docProtection, - disabled = this._isDisabled || this._state.equationLocked || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly; + unprotectedRegion = this.documentHolder._unprotectedRegion, + disabled = this._isDisabled || this._state.equationLocked || docProtection.isReadOnly && !unprotectedRegion.canInsObject || docProtection.isFormsOnly || docProtection.isCommentsOnly && !unprotectedRegion.canInsObject; if (eqContainer.length>0 && eqContainer.is(':visible')) { this.equationBtns.forEach(function(item){ diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 1ceca56ac9..4d459c3da1 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -73,6 +73,11 @@ define([ isFormsOnly: false, isCommentsOnly: false }; + this._unprotectedRegion = { + canEditText: false, + canEditPara: false, + canInsObject: false + }; this._langs = null; }, diff --git a/apps/documenteditor/main/app/view/DocumentHolderExt.js b/apps/documenteditor/main/app/view/DocumentHolderExt.js index b374bacd03..b232e41751 100644 --- a/apps/documenteditor/main/app/view/DocumentHolderExt.js +++ b/apps/documenteditor/main/app/view/DocumentHolderExt.js @@ -2134,7 +2134,7 @@ define([], function () { } me.menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled); - me.menuViewUndo.setDisabled(!me.api.asc_getCanUndo() || me._docProtection.isReadOnly); + me.menuViewUndo.setDisabled(!me.api.asc_getCanUndo()); me.menuViewCopySeparator.setVisible(isInSign); var isRequested = (signProps) ? signProps.asc_getRequested() : false;