[FIX] website: not lose cover properties values on inner content edition

Since [1], when editing cover texts only and saving, the cover
properties values (background, size, etc) were lost. This is because
we prepare the values to save only when one of them is edited... and
editing the cover texts is marking the cover as dirty thus without
the prepared cover properties values.

After this commit, the cover properties in the database are only updated
if the cover is marked as dirty *and* the values to save have been
prepared.

[1]: https://github.com/odoo/odoo/commit/ad59cbd33e0eaf5c7c77f9e5c0b0435917e2c155

task-2792006

X-original-commit: dffe8d2f8809a3e8e841bea1f2164fa42b578906
Part-of: odoo/odoo#88482
This commit is contained in:
qsm-odoo
2022-04-11 19:02:01 +02:00
parent 8700c7aad4
commit 65ee7ed131
@@ -119,6 +119,13 @@ Wysiwyg.include({
throw new Error('There should be a model and id associated to the cover');
}
// The cover might be dirty for another reason than cover properties
// values only (like an editable text inside). In that case, do not
// update the cover properties values.
if (!('coverClass' in el.dataset)) {
return;
}
this.__savedCovers = this.__savedCovers || {};
this.__savedCovers[resModel] = this.__savedCovers[resModel] || [];