From 4224c75d7d885810fd445d4d5830184770b2941b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 31 Oct 2017 14:16:31 +0300 Subject: [PATCH] Color palette refactoring: reselect current custom color when custom colors were changed. --- apps/common/main/lib/component/ThemeColorPalette.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/common/main/lib/component/ThemeColorPalette.js b/apps/common/main/lib/component/ThemeColorPalette.js index 71bc9f127..ec5265ba5 100644 --- a/apps/common/main/lib/component/ThemeColorPalette.js +++ b/apps/common/main/lib/component/ThemeColorPalette.js @@ -146,6 +146,11 @@ define([ updateCustomColors: function() { var el = $(this.el); if (el) { + var selected = el.find('a.' + this.selectedCls), + color = (selected.length>0 && /color-dynamic/.test(selected[0].className)) ? selected.attr('color') : undefined; + if (color) color = color.toUpperCase(); + selected.removeClass(this.selectedCls); + var colors = Common.localStorage.getItem('asc.'+Common.localStorage.getId()+'.colors.custom'); colors = colors ? colors.split(',') : []; @@ -156,6 +161,10 @@ define([ colorEl.find('span').css({ 'background-color': '#'+colors[i] }); + if (colors[i] == color) { + colorEl.addClass(this.selectedCls); + color = undefined; //select only first found color + } } } },