[SSE] Fix getting protection options

This commit is contained in:
Julia Radzhabova 2021-08-12 01:42:14 +03:00
parent c1a400019c
commit eb93f3562a

View file

@ -91,7 +91,7 @@ define([
this.api = api; this.api = api;
this.api.asc_registerCallback('asc_onChangeProtectWorkbook',_.bind(this.onChangeProtectWorkbook, this)); this.api.asc_registerCallback('asc_onChangeProtectWorkbook',_.bind(this.onChangeProtectWorkbook, this));
this.api.asc_registerCallback('asc_onChangeProtectWorksheet',_.bind(this.onChangeProtectSheet, this)); this.api.asc_registerCallback('asc_onChangeProtectWorksheet',_.bind(this.onChangeProtectSheet, this));
this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.onApiSheetChanged, this)); this.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(this.onActiveSheetChanged, this));
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this)); this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
} }
@ -290,7 +290,7 @@ define([
}, },
onChangeProtectSheet: function() { onChangeProtectSheet: function() {
var props = this.getWSProps(); var props = this.getWSProps(true);
this.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet this.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet
Common.Utils.lockControls(SSE.enumLock['Objects'], props.wsProps['Objects'], { array: [this.view.chLockedText, this.view.chLockedShape]}); Common.Utils.lockControls(SSE.enumLock['Objects'], props.wsProps['Objects'], { array: [this.view.chLockedText, this.view.chLockedShape]});
@ -298,11 +298,12 @@ define([
Common.NotificationCenter.trigger('protect:wslock', props); Common.NotificationCenter.trigger('protect:wslock', props);
}, },
onApiSheetChanged: function() { onActiveSheetChanged: function() {
this.onChangeProtectSheet(); //current sheet this.onChangeProtectSheet(); //current sheet
}, },
getWSProps: function() { getWSProps: function(update) {
if (update || !this._state.protection) {
var wsProtected = !!this.api.asc_isProtectedSheet(); var wsProtected = !!this.api.asc_isProtectedSheet();
var arr = []; var arr = [];
if (wsProtected) { if (wsProtected) {
@ -316,8 +317,10 @@ define([
arr[item] = false; arr[item] = false;
}); });
} }
this._state.protection = {wsLock: wsProtected, wsProps: arr};
}
return {wsLock: wsProtected, wsProps: arr}; return this._state.protection;
}, },
onApiSelectionChanged: function(info) { onApiSelectionChanged: function(info) {