From ea5fc6933d30c17247263b5b564941c66ef0a478 Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Mon, 6 Dec 2021 10:07:51 +0000 Subject: [PATCH] [FIX] web_editor: fix unlink when nested tag Whenever there was a tag inside a link (e.g.`link`), it was impossible to unlink. closes odoo/odoo#81112 X-original-commit: a7f2027c6131309b239026b4e1299a6f396171dd Signed-off-by: David Monjoie (dmo) --- .../static/lib/odoo-editor/src/commands/commands.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js b/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js index ed072c66108..d67cf0a2dda 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js +++ b/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js @@ -416,8 +416,8 @@ export const editorCommands = { // we need to remove the contentEditable isolation of links // before we apply the unlink, otherwise the command is not performed // because the content editable root is the link - const closestEl = closestElement(sel.focusNode); - if (closestEl.tagName === 'A' && closestEl.getAttribute('contenteditable') === 'true') { + const closestEl = closestElement(sel.focusNode, 'a'); + if (closestEl && closestEl.getAttribute('contenteditable') === 'true') { editor._activateContenteditable(); } if (sel.isCollapsed) {