From a4e3685ccb99a560c36ae0547ae55a8bc888af4b Mon Sep 17 00:00:00 2001 From: "Emilien Durieu (edu)" Date: Tue, 10 Nov 2020 13:35:57 +0000 Subject: [PATCH] [FIX] web_editor: add color preview to color picker The web editor offered in-content preview when hovering over a color to change text or background color. This commit implements this behavior with Jabberwocky. closes odoo/odoo#61588 Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index f773064ac8a..c62fadfd4af 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -565,6 +565,12 @@ var Wysiwyg = Widget.extend({ colorpicker.on('color_picked', this, (e) => { this._setColor(colorpicker, setCommandId, unsetCommandId, e.data.color, $dropdownNode, true); }); + colorpicker.on('color_hover', this, (e) => { + this._setColor(colorpicker, setCommandId, unsetCommandId, e.data.color, $dropdownNode, false); + }); + colorpicker.on('color_leave', this, (e) => { + this._setColor(colorpicker, 'undo', 'undo', undefined, $dropdownNode, false); + }); } }, /**