[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) <dmo@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit is contained in:
Benoit Socias
2022-05-25 08:48:41 +02:00
parent 2abc92afe5
commit fa550fbc76
@@ -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();