[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) <dmo@odoo.com>
This commit is contained in:
Nicolas Bayet
2021-10-28 07:49:29 +00:00
parent 3c80860110
commit 0f668e28bf
@@ -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) {