From 51e6b349e31ab7c8e8d0b0539d2ebbe45022931b Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Tue, 11 Jan 2022 14:25:25 +0000 Subject: [PATCH] [FIX] web_editor: open the linktool when clicking an element inlide link Whenever we clicked on a link that contained another element (eg. span, bold, ...), the LinkTool did not open. Task-2667989 closes odoo/odoo#83437 X-original-commit: d69d26a2dd8830aca8c5922d3548e5ff59c688fc Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 8b3566a7484..c41a5301bd5 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -246,10 +246,10 @@ const Wysiwyg = Widget.extend({ this._updateEditorUI(); this.$root.on('click', (ev) => { - const $target = $(ev.target); + const $target = $(ev.target).closest('a'); // Keep popover open if clicked inside it, but not on a button - if ($target.parents('.o_edit_menu_popover').length && !$target.parent('a').addBack('a').length) { + if ($(ev.target).parents('.o_edit_menu_popover').length && !$target.length) { ev.preventDefault(); } @@ -270,7 +270,7 @@ const Wysiwyg = Widget.extend({ // here relies on clicking in that editor panel... await this.snippetsMenu._mutex.exec(() => null); } - this.linkPopover = await weWidgets.LinkPopoverWidget.createFor(this, ev.target, { wysiwyg: this }); + this.linkPopover = await weWidgets.LinkPopoverWidget.createFor(this, $target[0], { wysiwyg: this }); $target.data('popover-widget-initialized', this.linkPopover); })(); }