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