[SSE] Fix clear format on protected sheet

This commit is contained in:
Julia Radzhabova 2021-08-10 17:49:40 +03:00
parent cda49d94f8
commit aad4885398
3 changed files with 14 additions and 3 deletions

View file

@ -537,7 +537,12 @@ define([
},
onClear: function(menu, item, e) {
Common.NotificationCenter.trigger('protect:check', this.onClearCallback, this, [menu, item]);
if (item.value == Asc.c_oAscCleanOptions.Format && !this._state.wsProps['FormatCells'] || item.value == Asc.c_oAscCleanOptions.All && !this.api.asc_checkLockedCells())
this.onClearCallback(menu, item);
else if (item.value == Asc.c_oAscCleanOptions.Comments) {
this._state.wsProps['Objects'] ? Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ChangeOnProtectedSheet, Asc.c_oAscError.Level.NoCritical) : this.onClearCallback(menu, item);
} else
Common.NotificationCenter.trigger('protect:check', this.onClearCallback, this, [menu, item]);
},
onClearCallback: function(menu, item) {

View file

@ -215,6 +215,7 @@ define([
Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this));
Common.NotificationCenter.on('protect:check', _.bind(this.checkProtectedRange, this));
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
this.stackLongActions = new Common.IrregularStack({
strongCompare : this._compareActionStrong,
@ -2176,7 +2177,7 @@ define([
},
checkProtectedRange: function(callback, scope, args) {
var result = this.api.asc_isProtectedSheet() ? this.api.asc_checkActiveCellProtectedRange() : false;
var result = this.api.asc_isProtectedSheet() ? this.api.asc_checkProtectedRange() : false;
if (result===null) {
this.onError(Asc.c_oAscError.ID.ChangeOnProtectedSheet, Asc.c_oAscError.Level.NoCritical);
return;

View file

@ -1462,7 +1462,12 @@ define([
},
onClearStyleMenu: function(menu, item, e) {
Common.NotificationCenter.trigger('protect:check', this.onClearStyleMenuCallback, this, [menu, item]);
if (item.value == Asc.c_oAscCleanOptions.Format && !this._state.wsProps['FormatCells'] || item.value == Asc.c_oAscCleanOptions.All && !this.api.asc_checkLockedCells())
this.onClearStyleMenuCallback(menu, item);
else if (item.value == Asc.c_oAscCleanOptions.Comments) {
this._state.wsProps['Objects'] ? Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ChangeOnProtectedSheet, Asc.c_oAscError.Level.NoCritical) : this.onClearStyleMenuCallback(menu, item);
} else
Common.NotificationCenter.trigger('protect:check', this.onClearStyleMenuCallback, this, [menu, item]);
},
onClearStyleMenuCallback: function(menu, item, e) {