Merge pull request #1295 from ONLYOFFICE/fix/cell-color

[SSE] Fix cell color
This commit is contained in:
Julia Radzhabova 2021-11-09 17:10:18 +03:00 committed by GitHub
commit 70a00507d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 13 deletions

View file

@ -604,39 +604,35 @@ define([
}, },
onTextColor: function() { onTextColor: function() {
this.toolbar.mnuTextColorPicker.trigger('select', this.toolbar.mnuTextColorPicker, this.toolbar.mnuTextColorPicker.currentColor, true); this.toolbar.mnuTextColorPicker.trigger('select', this.toolbar.mnuTextColorPicker, this.toolbar.mnuTextColorPicker.currentColor);
}, },
onBackColor: function() { onBackColor: function() {
this.toolbar.mnuBackColorPicker.trigger('select', this.toolbar.mnuBackColorPicker, this.toolbar.mnuBackColorPicker.currentColor, true); this.toolbar.mnuBackColorPicker.trigger('select', this.toolbar.mnuBackColorPicker, this.toolbar.mnuBackColorPicker.currentColor);
}, },
onTextColorSelect: function(btn, color, fromBtn) { onTextColorSelect: function(btn, color) {
this._state.clrtext_asccolor = this._state.clrtext = undefined; this._state.clrtext_asccolor = this._state.clrtext = undefined;
this.toolbar.btnTextColor.currentColor = color; this.toolbar.btnTextColor.currentColor = color;
this.toolbar.mnuTextColorPicker.currentColor = color; this.toolbar.mnuTextColorPicker.currentColor = color;
if (this.api) { if (this.api) {
this.toolbar.btnTextColor.ischanged = (fromBtn!==true);
this.api.asc_setCellTextColor(color.isAuto ? color.color : Common.Utils.ThemeColor.getRgbColor(color)); this.api.asc_setCellTextColor(color.isAuto ? color.color : Common.Utils.ThemeColor.getRgbColor(color));
this.toolbar.btnTextColor.ischanged = false;
} }
Common.NotificationCenter.trigger('edit:complete', this.toolbar, {restorefocus:true}); Common.NotificationCenter.trigger('edit:complete', this.toolbar, {restorefocus:true});
Common.component.Analytics.trackEvent('ToolBar', 'Text Color'); Common.component.Analytics.trackEvent('ToolBar', 'Text Color');
}, },
onBackColorSelect: function(btn, color, fromBtn) { onBackColorSelect: function(btn, color) {
this._state.clrshd_asccolor = this._state.clrback = undefined; this._state.clrshd_asccolor = this._state.clrback = undefined;
this.toolbar.btnBackColor.currentColor = color; this.toolbar.btnBackColor.currentColor = color;
this.toolbar.mnuBackColorPicker.currentColor = color; this.toolbar.mnuBackColorPicker.currentColor = color;
if (this.api) { if (this.api) {
this.toolbar.btnBackColor.ischanged = (fromBtn!==true);
this.api.asc_setCellBackgroundColor(color == 'transparent' ? null : Common.Utils.ThemeColor.getRgbColor(color)); this.api.asc_setCellBackgroundColor(color == 'transparent' ? null : Common.Utils.ThemeColor.getRgbColor(color));
this.toolbar.btnBackColor.ischanged = false;
} }
Common.component.Analytics.trackEvent('ToolBar', 'Background Color'); Common.component.Analytics.trackEvent('ToolBar', 'Background Color');
@ -2446,7 +2442,7 @@ define([
color, color,
fontColorPicker = this.toolbar.mnuTextColorPicker; fontColorPicker = this.toolbar.mnuTextColorPicker;
if (!toolbar.btnTextColor.ischanged && !fontColorPicker.isDummy) { if (!fontColorPicker.isDummy) {
color = fontobj.asc_getFontColor(); color = fontobj.asc_getFontColor();
if (color) { if (color) {
if (color.get_auto()) { if (color.get_auto()) {
@ -2608,7 +2604,7 @@ define([
fontColorPicker = this.toolbar.mnuTextColorPicker, fontColorPicker = this.toolbar.mnuTextColorPicker,
paragraphColorPicker = this.toolbar.mnuBackColorPicker; paragraphColorPicker = this.toolbar.mnuBackColorPicker;
if (!toolbar.btnTextColor.ischanged && !fontColorPicker.isDummy) { if (!fontColorPicker.isDummy) {
color = xfs.asc_getFontColor(); color = xfs.asc_getFontColor();
if (color) { if (color) {
if (color.get_auto()) { if (color.get_auto()) {
@ -2651,9 +2647,9 @@ define([
} }
/* read cell background color */ /* read cell background color */
if (!toolbar.btnBackColor.ischanged && !paragraphColorPicker.isDummy) { if (!paragraphColorPicker.isDummy) {
color = xfs.asc_getFillColor(); color = xfs.asc_getFillColor();
if (color) { if (color && !color.get_auto()) {
if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() };
} else { } else {

View file

@ -1267,7 +1267,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
setColor: function(color, control, picker) { setColor: function(color, control, picker) {
picker = control ? control.colorPicker : picker; picker = control ? control.colorPicker : picker;
if (color) { if (color && !color.get_auto()) {
if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
color = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() }; color = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() };
} else { } else {