Commit 14c2a177 authored by Julia Radzhabova's avatar Julia Radzhabova

[SSE] Disable inserting sparklines when objects are selected (shape, image, chart).

parent 1ed82bd3
...@@ -101,7 +101,8 @@ define([ ...@@ -101,7 +101,8 @@ define([
id: Common.UI.getId(), id: Common.UI.getId(),
selected: false, selected: false,
allowSelected: true, allowSelected: true,
value: null value: null,
disabled: false
} }
} }
}); });
...@@ -142,6 +143,7 @@ define([ ...@@ -142,6 +143,7 @@ define([
el.off('click').on('click', _.bind(this.onClick, this)); el.off('click').on('click', _.bind(this.onClick, this));
el.off('dblclick').on('dblclick', _.bind(this.onDblClick, this)); el.off('dblclick').on('dblclick', _.bind(this.onDblClick, this));
el.off('contextmenu').on('contextmenu', _.bind(this.onContextMenu, this)); el.off('contextmenu').on('contextmenu', _.bind(this.onContextMenu, this));
el.toggleClass('disabled', this.model.get('disabled'));
if (!_.isUndefined(this.model.get('cls'))) if (!_.isUndefined(this.model.get('cls')))
el.addClass(this.model.get('cls')); el.addClass(this.model.get('cls'));
...@@ -159,10 +161,14 @@ define([ ...@@ -159,10 +161,14 @@ define([
}, },
onClick: function(e) { onClick: function(e) {
if (this.model.get('disabled')) return false;
this.trigger('click', this, this.model, e); this.trigger('click', this, this.model, e);
}, },
onDblClick: function(e) { onDblClick: function(e) {
if (this.model.get('disabled')) return false;
this.trigger('dblclick', this, this.model, e); this.trigger('dblclick', this, this.model, e);
}, },
......
...@@ -46,12 +46,19 @@ ...@@ -46,12 +46,19 @@
display: inline-block; display: inline-block;
float: left; float: left;
margin: 2px 4px 4px; margin: 2px 4px 4px;
cursor: pointer;
&:not(.disabled) {
cursor: pointer;
}
&.disabled {
opacity: 0.5;
}
.box-shadow(0 0 0 1px @gray); .box-shadow(0 0 0 1px @gray);
&:hover, &:hover:not(.disabled),
&.selected { &.selected:not(.disabled) {
.box-shadow(0 0 0 2px @primary); .box-shadow(0 0 0 2px @primary);
} }
} }
......
...@@ -100,7 +100,8 @@ define([ ...@@ -100,7 +100,8 @@ define([
tablename: undefined, tablename: undefined,
namedrange_locked: false, namedrange_locked: false,
fontsize: undefined, fontsize: undefined,
multiselect: false multiselect: false,
sparklines_disabled: false
}; };
var checkInsertAutoshape = function(e, action) { var checkInsertAutoshape = function(e, action) {
...@@ -1625,6 +1626,16 @@ define([ ...@@ -1625,6 +1626,16 @@ define([
toolbar.lockToolbar(SSE.enumLock.cantHyperlink, (selectionType == Asc.c_oAscSelectionType.RangeShapeText) && (this.api.asc_canAddShapeHyperlink()===false), { array: [toolbar.btnInsertHyperlink]}); toolbar.lockToolbar(SSE.enumLock.cantHyperlink, (selectionType == Asc.c_oAscSelectionType.RangeShapeText) && (this.api.asc_canAddShapeHyperlink()===false), { array: [toolbar.btnInsertHyperlink]});
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) {
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;
}
}
if (editOptionsDisabled) return; if (editOptionsDisabled) return;
/* read font params */ /* read font params */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment