From 34e8b7874b202e34ac71f4660fd73e20a9839f7b Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Tue, 8 Feb 2022 15:53:46 +0000 Subject: [PATCH] [FIX] web_editor: properly add image in editable rather than in toolbar In mass_mailing, when clicking the media button in the toolbar, the image would end up being added to the media button itself rather than at the selection. That is because the selection had been replaced by the button. This fixes it by preventing default behavior of the mousedown event on toolbar (thereby preventing the change of selection). task-2745984 closes odoo/odoo#84218 X-original-commit: da55a5fa6344734bf751a5976e0dc5bdacd4e119 Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index f3cfec6fe1a..daeab7f27b7 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1057,6 +1057,7 @@ const Wysiwyg = Widget.extend({ _configureToolbar: function (options) { const $toolbar = this.toolbar.$el; + $toolbar.on('mousedown', e => e.preventDefault()); const openTools = e => { e.preventDefault(); e.stopImmediatePropagation();