[FIX] web_editor: allow edition of branded nodes only

To be able to be saved, nodes have to provide information on where to
save them. This is done through the use of data attributes. Nodes that
do not have these data attributes or are not contained within nodes that
do, should therefore not be editable.
Recent changes in Jabberwock ensure that the nodes with these data
attributes are saved either as `OdooStructureNode` or as `OdooFieldNode`
so we can simply check for these.

closes odoo/odoo#63311

X-original-commit: adf778d4bb499c6beb6b54d8093ced4f81d2ac57
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Antoine Guenet
2020-12-14 11:01:24 +00:00
parent f2d4ba6890
commit 4e103b25f1
@@ -96,6 +96,21 @@ var Wysiwyg = Widget.extend({
this._modeConfig = {
id: 'edit',
rules: [
{
selector: [
(node) => {
return !node.closest(ancestor => {
return (
ancestor instanceof this.JWEditorLib.OdooStructureNode ||
ancestor instanceof this.JWEditorLib.OdooFieldNode
);
});
},
],
properties: {
editable: { value: false },
},
},
{
selector: [
(node) => {