diff --git a/apps/spreadsheeteditor/main/app/controller/CellEditor.js b/apps/spreadsheeteditor/main/app/controller/CellEditor.js index 5c7dba1a2..b380d0642 100644 --- a/apps/spreadsheeteditor/main/app/controller/CellEditor.js +++ b/apps/spreadsheeteditor/main/app/controller/CellEditor.js @@ -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; diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index a6f33c42f..2423120b9 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -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) {