diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js index fd357e061b9..1efe2f45624 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js @@ -1337,14 +1337,13 @@ export function isUnbreakable(node) { } export function isUnremovable(node) { - if (node.nodeType !== Node.ELEMENT_NODE && node.nodeType !== Node.TEXT_NODE) { - return true; - } return ( + (node.nodeType !== Node.ELEMENT_NODE && node.nodeType !== Node.TEXT_NODE) || node.oid === 'root' || (node.nodeType === Node.ELEMENT_NODE && (node.classList.contains('o_editable') || node.getAttribute('t-set') || node.getAttribute('t-call'))) || - (node.classList && node.classList.contains('oe_unremovable')) + (node.classList && node.classList.contains('oe_unremovable')) || + (node.ownerDocument && node.ownerDocument.defaultWindow && !ancestors(node).find(ancestor => ancestor.oid === 'root')) // Node is in DOM but not in editable. ); }