summaryrefslogtreecommitdiff
path: root/addons/web_editor/static
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2021-02-23 10:34:43 +0000
committerNicolas Lempereur <nle@odoo.com>2021-02-23 10:41:21 +0000
commit6e47db5efcd78157f054144315a4812bbb6fbbd9 (patch)
tree117fbe31d4a432830902acb0e0b1a4379ed31bc5 /addons/web_editor/static
parent90694e09d4e7ebd888c0e0386e739e487a65b9b4 (diff)
[FIX] web_editor: bgOptimize+parallax=bg no kaput
Scenario: - set new background image - set parallax - save => on next edition, the editor doesn't work on background anymore Why: - backgroundOptimize copy attributes of the original image to the real target element on save - parallax change the real target element to a new child => so if the original element was an editor (with data-oe-model, ...) attributes, with the combination of the two options we will save these editing attribute on the child element which is wrong (the editing attributes are added dynamically and should not be saved). With this changeset, we don't copy the editing attributes in backgroundOptimize when we copy the original target image. opw-2427560 opw-2429340 closes odoo/odoo#66665 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/web_editor/static')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.options.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js
index 621cd9b4d6f..841383c589d 100644
--- a/addons/web_editor/static/src/js/editor/snippets.options.js
+++ b/addons/web_editor/static/src/js/editor/snippets.options.js
@@ -3528,7 +3528,10 @@ registry.BackgroundOptimize = ImageHandlerOption.extend({
*/
async _loadImageInfo() {
this.img = new Image();
- Object.entries(this.$target[0].dataset).forEach(([key, value]) => {
+ Object.entries(this.$target[0].dataset).filter(([key]) =>
+ // Avoid copying dynamic editor attributes
+ !['oeId','oeModel', 'oeField', 'oeXpath', 'noteId'].includes(key)
+ ).forEach(([key, value]) => {
this.img.dataset[key] = value;
});
const src = getBgImageURL(this.$target[0]);