From ff8ee482b86353ae276bc0ddc2e1998b776f3604 Mon Sep 17 00:00:00 2001 From: visp-odoo Date: Fri, 3 Nov 2023 16:19:33 +0530 Subject: [PATCH] [FIX] web_editor: tab outside link hides linkpopover MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit: Tab on link moves link table but the link popover stucks. After this commit: Tab outsided the link hides the linkpopover. task-3389015 closes odoo/odoo#145297 X-original-commit: e9ada60cb1f6986a578e17ddce1f5ae6a6fe95dc Signed-off-by: Geelen Sébastien (sge) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 7 ++++--- 1 file changed, 4 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 add61a34f1e..8dd7b67cdbd 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -2749,9 +2749,10 @@ export class Wysiwyg extends Component { } } _onSelectionChange() { - if (this.odooEditor.autohideToolbar) { - const isVisible = this.linkPopover && this.linkPopover.el.offsetParent; - if (isVisible && !this.odooEditor.document.getSelection().isCollapsed) { + if (this.odooEditor.autohideToolbar && this.linkPopover) { + const selectionInLink = getInSelection(this.odooEditor.document, 'a') === this.linkPopover.target; + const isVisible = this.linkPopover.el.offsetParent; + if (isVisible && !selectionInLink) { this.linkPopover.hide(); } }