[REF] website: make mutation processing more robust

This probably does not change much but it short-circuit a bunch of code
when we click outside of an editable zone and something in the DOM
happens. Allows for easier debugging of mutations. It also avoids the
creation of a jQuery object when the mutation is about changing a
contenteditable attribute, I guess any small perf improvement should be
welcomed.

Related to runbot-18747

X-original-commit: f93a2da57e1424898fbf6e157945e2afa97be89e
Part-of: odoo/odoo#148728
This commit is contained in:
qsm-odoo
2024-01-10 10:28:17 +00:00
parent 8a459f1859
commit c31b534654
@@ -398,11 +398,17 @@ export class WysiwygAdapterComponent extends Wysiwyg {
// generated a new stack and break the "redo" of the editor.
this.odooEditor.automaticStepSkipStack();
for (const record of records) {
const $savable = $(record.target).closest(this.savableSelector);
if (record.attributeName === 'contenteditable') {
continue;
}
const $savable = $(record.target).closest(this.savableSelector);
if (!$savable.length) {
continue;
}
// Mark any savable element dirty if any tracked mutation occurs
// inside of it.
$savable.not('.o_dirty').each(function () {
if (!this.hasAttribute('data-oe-readonly')) {
this.classList.add('o_dirty');