[SSE] refactoring
This commit is contained in:
parent
e3bee31af6
commit
b87e85ac92
|
@ -91,6 +91,10 @@ define([
|
|||
|
||||
this.editor.$btnfunc[this.mode.isEdit?'removeClass':'addClass']('disabled');
|
||||
this.editor.btnNamedRanges.setVisible(this.mode.isEdit && !this.mode.isEditDiagram && !this.mode.isEditMailMerge);
|
||||
|
||||
if ( this.mode.isEdit ) {
|
||||
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this));
|
||||
}
|
||||
},
|
||||
|
||||
onInputKeyDown: function(e) {
|
||||
|
@ -132,6 +136,20 @@ define([
|
|||
this.editor.updateCellInfo(info);
|
||||
},
|
||||
|
||||
onApiSelectionChanged: function(info) {
|
||||
var seltype = info.asc_getFlags().asc_getSelectionType(),
|
||||
coauth_disable = (!this.mode.isEditMailMerge && !this.mode.isEditDiagram) ? (info.asc_getLocked() === true || info.asc_getLockedTable() === true) : false;
|
||||
|
||||
var is_chart_text = seltype == Asc.c_oAscSelectionType.RangeChartText,
|
||||
is_chart = seltype == Asc.c_oAscSelectionType.RangeChart,
|
||||
is_shape_text = seltype == Asc.c_oAscSelectionType.RangeShapeText,
|
||||
is_shape = seltype == Asc.c_oAscSelectionType.RangeShape,
|
||||
is_image = seltype == Asc.c_oAscSelectionType.RangeImage,
|
||||
is_mode_2 = is_shape_text || is_shape || is_chart_text || is_chart;
|
||||
|
||||
this.editor.$btnfunc.toggleClass('disabled', is_image || is_mode_2 || coauth_disable);
|
||||
},
|
||||
|
||||
onApiDisconnect: function() {
|
||||
this.mode.isEdit = false;
|
||||
|
||||
|
|
|
@ -1746,10 +1746,10 @@ define([
|
|||
need_disable = selectionType != Asc.c_oAscSelectionType.RangeCells && selectionType != Asc.c_oAscSelectionType.RangeCol &&
|
||||
selectionType != Asc.c_oAscSelectionType.RangeRow && selectionType != Asc.c_oAscSelectionType.RangeMax;
|
||||
if (this._state.sparklines_disabled !== need_disable) {
|
||||
this._state.sparklines_disabled = need_disable;
|
||||
var len = toolbar.mnuInsertChartPicker.store.length;
|
||||
for (var i=0; i<3; i++) {
|
||||
toolbar.mnuInsertChartPicker.store.at(len-i-1).set({disabled: need_disable});
|
||||
this._state.sparklines_disabled = need_disable;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2533,8 +2533,6 @@ define([
|
|||
toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked && (seltype==Asc.c_oAscSelectionType.RangeChart || seltype==Asc.c_oAscSelectionType.RangeChartText), { array: [toolbar.btnInsertChart] } );
|
||||
}
|
||||
|
||||
$('#ce-func-label').toggleClass('disabled', is_image || is_mode_2 || coauth_disable);
|
||||
|
||||
this._state.controlsdisabled.filters = is_image || is_mode_2 || coauth_disable;
|
||||
|
||||
if (is_image || is_mode_2 || coauth_disable) {
|
||||
|
|
Loading…
Reference in a new issue