From 0f668e28bf6b58d424ff49ab6b1d96af0bb6e167 Mon Sep 17 00:00:00 2001 From: Nicolas Bayet Date: Tue, 12 Oct 2021 09:12:30 +0000 Subject: [PATCH] [FIX] web_editor: allow non editable to be unbreakable When starting the editor in a web page, if there is no content, the oe_structure is not editable. Adding snippet at that moment will trigger `idSet` on the node with isUnbreakable returning `false` for the node that is unbreakable because of the check `!node.isContentEditable` in `isUnbreakable`. When setting the ouid for the first time with `idSet`, `getOuid` is called with `optimize` to `true`. So all the ancestor of a node that should be unbreakable will have the wrong ouid. Performing any command to a node with a wrong ouid is suceptible to wrongly be reverted. By removing `!node.isContentEditable`, the node will have the proper ouid in case an ancestor is not editable. task-2633368 closes odoo/odoo#79108 X-original-commit: 13804df7740317b8198e7c1de418ff019c05862b Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/lib/odoo-editor/src/utils/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/lib/odoo-editor/src/utils/utils.js b/addons/web_editor/static/lib/odoo-editor/src/utils/utils.js index c6ecc28572a..e941be467ac 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/utils/utils.js +++ b/addons/web_editor/static/lib/odoo-editor/src/utils/utils.js @@ -904,7 +904,7 @@ export function isBold(node) { } export function isUnbreakable(node) { - if (!node || node.nodeType === Node.TEXT_NODE || !node.isContentEditable) { + if (!node || node.nodeType === Node.TEXT_NODE) { return false; } if (node.nodeType !== Node.ELEMENT_NODE) {