From cda49d94f8dfb665991ae3a85ffe615587291e34 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 9 Aug 2021 01:00:41 +0300 Subject: [PATCH] [SSE] Disable name manager on protected sheet. Disable adding comments when objects are protected --- apps/spreadsheeteditor/main/app/controller/CellEditor.js | 1 + apps/spreadsheeteditor/main/app/controller/DocumentHolder.js | 5 ++++- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/CellEditor.js b/apps/spreadsheeteditor/main/app/controller/CellEditor.js index f6f88365f..ba3f04cc0 100644 --- a/apps/spreadsheeteditor/main/app/controller/CellEditor.js +++ b/apps/spreadsheeteditor/main/app/controller/CellEditor.js @@ -316,6 +316,7 @@ define([ } prev_name = name; }); + this.editor.btnNamedRanges.menu.items[0].setDisabled(!!this.api.asc_isProtectedSheet()); this.editor.btnNamedRanges.menu.items[1].setVisible(rangesMenu.items.length>2); }, diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index ebe965730..a54a0ba10 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -701,6 +701,8 @@ define([ }, onAddComment: function(item) { + if (this._state.wsProps['Objects']) return; + if (this.api && this.permissions.canCoAuthoring && this.permissions.canComments) { var controller = SSE.getController('Common.Controllers.Comments'), @@ -2111,6 +2113,7 @@ define([ documentHolder.pmiSparklines.setDisabled(isCellLocked || this._state.wsLock); documentHolder.pmiEntriesList.setDisabled(isCellLocked || this._state.wsLock); documentHolder.pmiAddNamedRange.setDisabled(isCellLocked || this._state.wsLock); + documentHolder.pmiAddComment.setDisabled(isCellLocked || this._state.wsProps['Objects']); if (inPivot) { var canGroup = this.api.asc_canGroupPivot(); @@ -2182,7 +2185,7 @@ define([ documentHolder.menuViewAddComment.setVisible(canComment); commentsController && commentsController.blockPopover(true); - documentHolder.menuViewAddComment.setDisabled(isCellLocked || isTableLocked); + documentHolder.menuViewAddComment.setDisabled(isCellLocked || isTableLocked || this._state.wsProps['Objects']); if (showMenu) this.showPopupMenu(documentHolder.viewModeMenu, {}, event); if (isInSign) { diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 9de7ecafc..94e5cbfa0 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -3762,7 +3762,8 @@ define([ this.btnsComment = []; if ( config.canCoAuthoring && config.canComments ) { var _set = SSE.enumLock; - this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment, [_set.lostConnect, _set.commentLock, _set.editCell], undefined, undefined, undefined, '1', 'bottom', 'small'); + this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment, + [_set.lostConnect, _set.commentLock, _set.editCell, _set['Objects']], undefined, undefined, undefined, '1', 'bottom', 'small'); if ( this.btnsComment.length ) { var _comments = SSE.getController('Common.Controllers.Comments').getView();