From d96298d62dffdcc03f361bc96514313d811746d4 Mon Sep 17 00:00:00 2001 From: Adnan Saiyed Date: Fri, 24 Nov 2023 10:21:20 +0000 Subject: [PATCH] [FIX] web_editor: selecting link makes editor dirty Current behaviour before commit: In a saved pad, putting cursor inside a link without making any other changes makes editor dirty. As result discard button appears on the top. Desired behaviour after commit: Now putting cursor inside a link without editing doesn't make editor dirty and discard button doesn't appear on top. task-3607361 closes odoo/odoo#151094 X-original-commit: d7f89ca078ec21fe0db49ae5b01f21caecd6abfa Signed-off-by: Antoine Guenet (age) --- .../static/src/js/editor/odoo-editor/src/utils/sanitize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/sanitize.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/sanitize.js index 00975c8114a..e458c247e53 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/sanitize.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/sanitize.js @@ -245,7 +245,7 @@ export function sanitize(nodeToSanitize, root = nodeToSanitize) { let node = isList ? block.parentElement : block; // Sanitize the tree. - while (node?.isConnected && root.contains(node)) { + while (node && !(root.isConnected && !node.isConnected) && root.contains(node)) { if (!isProtected(node)) { node = sanitizeNode(node, root); // The node itself might be replaced during sanitization. }