[IMP] web_editor: align t-field with other placeholders
This commit completes the addition of t-field with a few changes in its behaviour in the editor: - t-field nodes, like t-esc or t-out, are considered as unbreakable - similarly, they are defined as 'demo data' which cannot be edited closes odoo/odoo#128228 Related: odoo/enterprise#43978 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
committed by
Lucas Perais
parent
04a836f0c8
commit
dfdd8d7bb6
@@ -44,7 +44,7 @@ export class QWebPlugin {
|
||||
|
||||
this._fixInlines(subRoot);
|
||||
|
||||
const demoElements = subRoot.querySelectorAll('[t-esc], [t-raw], [t-out]');
|
||||
const demoElements = subRoot.querySelectorAll('[t-esc], [t-raw], [t-out], [t-field]');
|
||||
for (const element of demoElements) {
|
||||
element.setAttribute('contenteditable', 'false');
|
||||
}
|
||||
|
||||
@@ -1320,7 +1320,8 @@ export function isUnbreakable(node) {
|
||||
node.getAttribute('t-foreach') ||
|
||||
node.getAttribute('t-value') ||
|
||||
node.getAttribute('t-out') ||
|
||||
node.getAttribute('t-raw'))) ||
|
||||
node.getAttribute('t-raw')) ||
|
||||
node.getAttribute('t-field')) ||
|
||||
node.classList.contains('oe_unbreakable')
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user