[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) <dmo@odoo.com>
This commit is contained in:
Nicolas Bayet
2022-01-26 18:23:56 +00:00
parent 02b356cf82
commit 51e6b349e3
@@ -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);
})();
}