Merge pull request #1294 from ONLYOFFICE/fix/sse-protect

Fix/sse protect
This commit is contained in:
Julia Radzhabova 2021-11-09 13:08:54 +03:00 committed by GitHub
commit b6b126027e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,6 +152,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
_setDefaults: function (props) {
this.refreshRangeList(props, 0);
this.currentSheet = this.api.asc_getActiveWorksheetIndex();
this.api.asc_registerCallback('asc_onLockProtectedRangeManager', this.wrapEvents.onLockProtectedRangeManager);
this.api.asc_registerCallback('asc_onUnLockProtectedRangeManager', this.wrapEvents.onUnLockProtectedRangeManager);
this.api.asc_registerCallback('asc_onLockProtectedRange', this.wrapEvents.onLockProtectedRange);
@ -167,6 +168,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
name: ranges[i].asc_getName() || '',
pwd: ranges[i].asc_isPassword(),
range: ranges[i].asc_getSqref() || '',
rangeId: ranges[i].asc_getId(),
props: ranges[i],
lock: (id!==null && id!==undefined),
lockuser: (id) ? this.getUserName(id) : this.guestText
@ -334,7 +336,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
return this.guestText;
},
onSelectRangeItem: function(lisvView, itemView, record) {
onSelectRangeItem: function(listView, itemView, record) {
if (!record) return;
this.userTipHide();
@ -380,8 +382,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
if (this.currentSheet !== index) return;
this.locked = true;
this.updateButtons();
if (this.userTooltip===true && this.rulesList.cmpEl.find('.lock-user').length>0)
this.rulesList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this));
if (this.userTooltip===true && this.rangeList.cmpEl.find('.lock-user').length>0)
this.rangeList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this));
},
onUnLockProtectedRangeManager: function(index) {
@ -390,23 +392,23 @@ define([ 'text!spreadsheeteditor/main/app/template/ProtectRangesDlg.template',
this.updateButtons();
},
onLockProtectedRange: function(index, ruleId, userId) {
onLockProtectedRange: function(index, rangeId, userId) {
if (this.currentSheet !== index) return;
var store = this.rulesList.store,
rec = store.findWhere({ruleId: ruleId});
var store = this.rangeList.store,
rec = store.findWhere({rangeId: rangeId});
if (rec) {
rec.set('lockuser', (userId) ? this.getUserName(userId) : this.guestText);
rec.set('lock', true);
this.updateButtons();
}
if (this.userTooltip===true && this.rulesList.cmpEl.find('.lock-user').length>0)
this.rulesList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this));
if (this.userTooltip===true && this.rangeList.cmpEl.find('.lock-user').length>0)
this.rangeList.cmpEl.on('mouseover', _.bind(this.onMouseOverLock, this)).on('mouseout', _.bind(this.onMouseOutLock, this));
},
onUnLockProtectedRange: function(index, ruleId) {
onUnLockProtectedRange: function(index, rangeId) {
if (this.currentSheet !== index) return;
var store = this.rulesList.store,
rec = store.findWhere({ruleId: ruleId});
var store = this.rangeList.store,
rec = store.findWhere({rangeId: rangeId});
if (rec) {
rec.set('lockuser', '');
rec.set('lock', false);