[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) <age@odoo.com>
This commit is contained in:
Adnan Saiyed
2024-01-29 10:20:04 +00:00
parent f16b194eaa
commit d96298d62d
@@ -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.
}