[SSE] Protect refactoring, lock hyperlink insert
This commit is contained in:
parent
304af6ae6e
commit
6aeda263a8
|
@ -148,7 +148,6 @@ define([
|
|||
});
|
||||
Common.NotificationCenter.on('page:settings', _.bind(this.onApiSheetChanged, this));
|
||||
Common.NotificationCenter.on('formula:settings', _.bind(this.applyFormulaSettings, this));
|
||||
Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this));
|
||||
|
||||
this.editMode = true;
|
||||
this._isAddingShape = false;
|
||||
|
@ -1821,6 +1820,7 @@ define([
|
|||
this.api.asc_registerCallback('asc_onUpdateDocumentProps', _.bind(this.onUpdateDocumentProps, this));
|
||||
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
|
||||
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
|
||||
Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this));
|
||||
}
|
||||
|
||||
if ( !this.appConfig.isEditMailMerge ) {
|
||||
|
@ -1950,7 +1950,7 @@ define([
|
|||
};
|
||||
Common.util.Shortcuts.delegateShortcuts({shortcuts: shortcuts});
|
||||
|
||||
this.onApiSelectionChanged(this.api.asc_getCellInfo());
|
||||
this.onChangeProtectSheet();
|
||||
this.attachToControlEvents();
|
||||
this.onApiSheetChanged();
|
||||
|
||||
|
@ -2506,7 +2506,7 @@ define([
|
|||
// disable on protected sheet
|
||||
need_disable = (selectionType === Asc.c_oAscSelectionType.RangeImage || selectionType === Asc.c_oAscSelectionType.RangeChart || selectionType === Asc.c_oAscSelectionType.RangeChartText ||
|
||||
selectionType === Asc.c_oAscSelectionType.RangeShape || selectionType === Asc.c_oAscSelectionType.RangeShapeText || selectionType === Asc.c_oAscSelectionType.RangeSlicer);
|
||||
toolbar.lockToolbar(need_disable ? SSE.enumLock['Objects'] : SSE.enumLock['FormatCells'], need_disable ? this._state.wsProps['Objects'] : this._state.wsProps['FormatCells'],
|
||||
toolbar.lockToolbar(need_disable ? SSE.enumLock['Objects'] : SSE.enumLock['FormatCells'], need_disable ? !!this._state.wsProps['Objects'] : !!this._state.wsProps['FormatCells'],
|
||||
{ clear: [SSE.enumLock['FormatCells'], SSE.enumLock['Objects']]});
|
||||
|
||||
if (editOptionsDisabled) return;
|
||||
|
@ -3992,12 +3992,17 @@ define([
|
|||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
},
|
||||
|
||||
onChangeProtectSheet: function(props, state) {
|
||||
this._state.wsProps = props;
|
||||
this._state.wsLock = state;
|
||||
|
||||
if (this._state.activated) {
|
||||
this.toolbar.lockToolbar(SSE.enumLock.wsLock, state);
|
||||
onChangeProtectSheet: function(props) {
|
||||
if (!props) {
|
||||
var wbprotect = this.getApplication().getController('WBProtection');
|
||||
props = wbprotect ? wbprotect.getWSProps() : null;
|
||||
}
|
||||
if (props) {
|
||||
this._state.wsProps = props.wsProps;
|
||||
this._state.wsLock = props.wsLock;
|
||||
|
||||
this.toolbar.lockToolbar(SSE.enumLock.wsLock, this._state.wsLock);
|
||||
this.toolbar.lockToolbar(SSE.enumLock['InsertHyperlinks'], this._state.wsProps['InsertHyperlinks'], {array: [this.toolbar.btnInsertHyperlink]});
|
||||
this.onApiSelectionChanged(this.api.asc_getCellInfo());
|
||||
}
|
||||
},
|
||||
|
|
|
@ -68,7 +68,7 @@ define([
|
|||
});
|
||||
},
|
||||
onLaunch: function () {
|
||||
this._state = {wsLock: false};
|
||||
this._state = {};
|
||||
this.wsLockOptions = ['SelectLockedCells', 'SelectUnlockedCells', 'FormatCells', 'FormatColumns', 'FormatRows', 'InsertColumns', 'InsertRows', 'InsertHyperlinks', 'DeleteColumns',
|
||||
'DeleteRows', 'Sort', 'AutoFilter', 'PivotTables', 'Objects', 'Scenarios'];
|
||||
SSE.enumLock && this.wsLockOptions.forEach(function(item){
|
||||
|
@ -94,7 +94,6 @@ define([
|
|||
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this));
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
||||
}
|
||||
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
|
||||
},
|
||||
|
||||
setMode: function(mode) {
|
||||
|
@ -271,7 +270,7 @@ define([
|
|||
})).then(function () {
|
||||
me.view.btnProtectWB.toggle(me.api.asc_isProtectedWorkbook(), true);
|
||||
me.view.btnProtectSheet.toggle(me.api.asc_isProtectedSheet(), true); //current sheet
|
||||
me.onChangeProtectSheet();
|
||||
me.onChangeProtectSheet(true);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -279,11 +278,19 @@ define([
|
|||
this.view.btnProtectWB.toggle(this.api.asc_isProtectedWorkbook(), true);
|
||||
},
|
||||
|
||||
onChangeProtectSheet: function() {
|
||||
var wsProtected = !!this.api.asc_isProtectedSheet();
|
||||
if (this._state.wsLock===wsProtected && !wsProtected) return;
|
||||
onChangeProtectSheet: function(suppressEvent) {
|
||||
var props = this.getWSProps();
|
||||
|
||||
this.view.btnProtectSheet.toggle(this.api.asc_isProtectedSheet(), true); //current sheet
|
||||
this.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet
|
||||
!suppressEvent && Common.NotificationCenter.trigger('protect:wslock', props);
|
||||
},
|
||||
|
||||
onApiSheetChanged: function() {
|
||||
this.onChangeProtectSheet(); //current sheet
|
||||
},
|
||||
|
||||
getWSProps: function() {
|
||||
var wsProtected = !!this.api.asc_isProtectedSheet();
|
||||
var arr = [];
|
||||
if (wsProtected) {
|
||||
arr = [];
|
||||
|
@ -296,12 +303,8 @@ define([
|
|||
arr[item] = false;
|
||||
});
|
||||
}
|
||||
this._state.wsLock = wsProtected;
|
||||
Common.NotificationCenter.trigger('protect:wslock', arr, this._state.wsLock);
|
||||
},
|
||||
|
||||
onApiSheetChanged: function() {
|
||||
this.onChangeProtectSheet(); //current sheet
|
||||
return {wsLock: wsProtected, wsProps: arr};
|
||||
},
|
||||
|
||||
onApiSelectionChanged: function(info) {
|
||||
|
@ -315,10 +318,6 @@ define([
|
|||
|
||||
onCoAuthoringDisconnect: function() {
|
||||
this.SetDisabled(true);
|
||||
},
|
||||
|
||||
onDocumentReady: function() {
|
||||
// this.onChangeProtectSheet();
|
||||
}
|
||||
|
||||
}, SSE.Controllers.WBProtection || {}));
|
||||
|
|
|
@ -716,7 +716,7 @@ define([
|
|||
cls : 'btn-toolbar x-huge icon-top',
|
||||
iconCls : 'toolbar__icon btn-inserthyperlink',
|
||||
caption : me.capInsertHyperlink,
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.editPivot]
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.editPivot, _set['InsertHyperlinks']]
|
||||
});
|
||||
|
||||
me.btnInsertChart = new Common.UI.Button({
|
||||
|
|
Loading…
Reference in a new issue