From fa550fbc764099b94bf5ef2c667833828f38fc42 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Tue, 24 May 2022 09:03:16 +0000 Subject: [PATCH] [FIX] web_editor: allow moving gradient color steps for text colors Since [1] gradient color steps cannot be moved anymore for the text foreground and background colors. This was already modified in [2] but it did not address the case of the color palettes. This commit makes sure that the mousedown events are not prevented within the color palettes that are spawned within the toolbar. Steps to reproduce: - Drop a "Text - Image" snippet. - Select the text header line. - Apply a custom text gradient. - Add an intermediary color step. - Try to move the new color step. => Color step could not be moved. [1]: https://github.com/odoo/odoo/commit/57701b2125f7de4fc543bd9c10642a5c11fa32b8 [2]: https://github.com/odoo/odoo/commit/84fd0b0a1bc1d874e7d6d6ff10b4fb6351f5a1af task-2862233 closes odoo/odoo#92210 X-original-commit: 50342251895d8397788c3f914a2e7abf5439813f Signed-off-by: David Monjoie (dmo) Signed-off-by: Benoit Socias (bso) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 83d3a514ba2..6d0239171ca 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1256,7 +1256,12 @@ const Wysiwyg = Widget.extend({ }, _configureToolbar: function (options) { const $toolbar = this.toolbar.$el; - $toolbar.find('.btn-group').on('mousedown', e => e.preventDefault()); + $toolbar.find('.btn-group').on('mousedown', e => { + // Do not prevent events on popovers. + if (!e.target.closest('.dropdown-menu')) { + e.preventDefault(); + } + }); const openTools = e => { e.preventDefault(); e.stopImmediatePropagation();