summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/common/utils.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2019-11-19 14:30:43 +0000
committerqsm-odoo <qsm@odoo.com>2019-12-01 15:49:57 +0000
commit216cf93b4dab381286991dcf650e859931bf1a43 (patch)
tree27bf2eec4d0c3fa17e9f1726ff3f3413057e5812 /addons/web_editor/static/src/js/common/utils.js
parent702a0cd5c5caecb7ce747dc049f88f03182185ff (diff)
[REF] web, web_editor, *: review normalization of colors
* website Review colorpicker methods to always allow to use normalized colors. Also factorize some code in the color palette widget. Part of https://github.com/odoo/odoo/pull/40282 In preparation of task-2122935 and other tasks
Diffstat (limited to 'addons/web_editor/static/src/js/common/utils.js')
-rw-r--r--addons/web_editor/static/src/js/common/utils.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/common/utils.js b/addons/web_editor/static/src/js/common/utils.js
index f3373c7bad2..67267d670ee 100644
--- a/addons/web_editor/static/src/js/common/utils.js
+++ b/addons/web_editor/static/src/js/common/utils.js
@@ -1,6 +1,8 @@
odoo.define('web_editor.utils', function (require) {
'use strict';
+const ColorpickerDialog = require('web.ColorpickerDialog');
+
/**
* window.getComputedStyle cannot work properly with CSS shortcuts (like
* 'border-width' which is a shortcut for the top + right + bottom + left border
@@ -116,6 +118,10 @@ function _getNumericAndUnit(value) {
* @returns {boolean}
*/
function _areCssValuesEqual(value1, value2, cssProp, $target) {
+ // If not colors, they will be left untouched
+ value1 = ColorpickerDialog.normalizeCSSColor(value1);
+ value2 = ColorpickerDialog.normalizeCSSColor(value2);
+
// String comparison first
if (value1 === value2) {
return true;