[SSE] Protect sheet from context menu

This commit is contained in:
Julia Radzhabova 2021-08-05 00:37:48 +03:00
parent 1603e3cf9b
commit 6a270a5e03
4 changed files with 21 additions and 5 deletions

View file

@ -308,6 +308,9 @@ define([
me.hideWorksheet(true, arrIndex);
}, 1);
break;
case 'protect':
this.protectWorksheet();
break;
}
},
@ -779,6 +782,10 @@ define([
this._sheetViewTip.hide();
},
protectWorksheet: function() {
Common.NotificationCenter.trigger('protect:sheet', !this.api.asc_isProtectedSheet());
},
zoomText : 'Zoom {0}%',
errorLastSheet : 'Workbook must have at least one visible worksheet.',
errorRemoveSheet: 'Can\'t delete the worksheet.',

View file

@ -77,6 +77,7 @@ define([
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('protect:sheet', _.bind(this.onSheetClick, this));
},
setConfig: function (data, api) {
this.setApi(api);

View file

@ -342,6 +342,7 @@ define([
caption: this.itemHidden,
menu: menuHiddenItems
},
{caption: this.itemProtect, value: 'protect'},
{
caption: this.itemTabColor,
menu: menuColorItems
@ -657,16 +658,19 @@ define([
this.tabMenu.items[4].setDisabled(issheetlocked || isdocprotected);
this.tabMenu.items[5].setDisabled(issheetlocked || isdocprotected);
this.tabMenu.items[6].setDisabled(isdoclocked || isdocprotected);
this.tabMenu.items[7].setDisabled(issheetlocked || isdocprotected);
this.tabMenu.items[7].setDisabled(select.length>1);
this.tabMenu.items[8].setDisabled(issheetlocked || isdocprotected);
this.tabMenu.items[7].setCaption(this.api.asc_isProtectedSheet() ? this.itemUnProtect : this.itemProtect);
if (select.length === 1) {
this.tabMenu.items[10].hide();
this.tabMenu.items[11].hide();
} else {
this.tabMenu.items[10].show();
this.tabMenu.items[11].show();
}
this.tabMenu.items[9].setDisabled(issheetlocked || isdocprotected);
this.tabMenu.items[10].setDisabled(issheetlocked || isdocprotected);
this.tabMenu.items[11].setDisabled(issheetlocked || isdocprotected);
this.api.asc_closeCellEditor();
this.api.asc_enableKeyEvents(false);
@ -857,7 +861,9 @@ define([
itemCount : 'Count',
itemMinimum : 'Minimum',
itemMaximum : 'Maximum',
itemSum : 'Sum'
itemSum : 'Sum',
itemProtect : 'Protect',
itemUnProtect : 'Unprotect'
}, SSE.Views.Statusbar || {}));
SSE.Views.Statusbar.RenameDialog = Common.UI.Window.extend(_.extend({

View file

@ -2978,6 +2978,8 @@
"SSE.Views.Statusbar.itemRename": "Rename",
"SSE.Views.Statusbar.itemSum": "Sum",
"SSE.Views.Statusbar.itemTabColor": "Tab Color",
"SSE.Views.Statusbar.itemProtect": "Protect",
"SSE.Views.Statusbar.itemUnProtect": "Unprotect",
"SSE.Views.Statusbar.RenameDialog.errNameExists": "Worksheet with such a name already exists.",
"SSE.Views.Statusbar.RenameDialog.errNameWrongChar": "A sheet name cannot contain the following characters: \\/*?[]:",
"SSE.Views.Statusbar.RenameDialog.labelSheetName": "Sheet Name",