summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorBenoit Socias <bso@odoo.com>2021-02-03 11:13:48 +0000
committerqsm-odoo <qsm@odoo.com>2021-02-15 15:49:15 +0000
commit7f19f63b18bc7d17a393b3535492c7f90595ca39 (patch)
treeec878602432ded418100393cec194c1b4da3023f /addons/web/static/src/js
parentf2fa17540e130b5cf3f70570a3a97495cfbb7499 (diff)
[FIX] web, web_editor: avoid rendering color palettes more than once
Before this commit the palette was rendered each time it was opened. After this commit if the palette has already been rendered only the selected color is being updated in the palette (and its colorpicker). task-2439295 https://github.com/odoo/odoo/pull/65223 Co-authored-by: Samuel Degueldre <sad@odoo.com>
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/widgets/colorpicker.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/addons/web/static/src/js/widgets/colorpicker.js b/addons/web/static/src/js/widgets/colorpicker.js
index c0805ca20b6..29e8c22aa0b 100644
--- a/addons/web/static/src/js/widgets/colorpicker.js
+++ b/addons/web/static/src/js/widgets/colorpicker.js
@@ -108,6 +108,17 @@ var ColorpickerWidget = Widget.extend({
this._super.apply(this, arguments);
$(document).off(`.${this.uniqueId}`);
},
+ /**
+ * Sets the currently selected color
+ *
+ * @param {string} color rgb[a]
+ */
+ setSelectedColor: function (color) {
+ var rgba = ColorpickerWidget.convertCSSColorToRgba(color);
+ if (rgba) {
+ this._updateRgba(rgba.red, rgba.green, rgba.blue, rgba.opacity);
+ }
+ },
//--------------------------------------------------------------------------
// Private