[FIX] web_editor: prevent Odoo editor hints on technical elements
Some templates contain empty <li> elements for styling purposes only and should be blacklisted in the context of Odoo editor hints as these elements are not editable. task-2550858 closes odoo/odoo#74944 Signed-off-by: Antoine Guenet <Zinston@users.noreply.github.com>
This commit is contained in:
@@ -153,6 +153,7 @@ export class OdooEditor extends EventTarget {
|
||||
return closestElement(selection.anchorNode, 'P, DIV');
|
||||
}
|
||||
},
|
||||
isHintBlacklisted: () => false,
|
||||
_t: string => string,
|
||||
},
|
||||
options,
|
||||
@@ -1825,7 +1826,9 @@ export class OdooEditor extends EventTarget {
|
||||
|
||||
for (const [selector, text] of Object.entries(selectors)) {
|
||||
for (const el of this.editable.querySelectorAll(selector)) {
|
||||
this._makeHint(el, text);
|
||||
if (!this.options.isHintBlacklisted(el)) {
|
||||
this._makeHint(el, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,10 @@ const Wysiwyg = Widget.extend({
|
||||
return !(node.hasAttribute && node.hasAttribute('data-oe-model')) && node;
|
||||
}
|
||||
},
|
||||
isHintBlacklisted: node => {
|
||||
return node.hasAttribute &&
|
||||
(node.hasAttribute('data-target') || node.hasAttribute('data-oe-model'));
|
||||
},
|
||||
noScrollSelector: 'body, .note-editable, .o_content, #wrapwrap',
|
||||
commands: commands,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user