summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/widgets.js
diff options
context:
space:
mode:
authorDenis Ledoux <dle@odoo.com>2016-12-19 13:50:07 +0100
committerDenis Ledoux <dle@odoo.com>2016-12-19 13:56:38 +0100
commitf616b2d20d4fbf364a1769b7b1a0cd6d12652bde (patch)
treeb0f18403445e64b31d7e353195eb1b661d28a8a7 /addons/web_editor/static/src/js/widgets.js
parent4e60d28d00550235e0a4091a769f68f8cb51051c (diff)
[FIX] web_editor: do not focus or set an empty image
When editing the website, adding a gallery, choosing the grid mode and then adding images, an extra, empty, image was added to the grid, in the first position, making it looking weird or at least not aligned. This was due to the `start` method of the widget, which is trying to focus the image in the images browser when you double click on an image (in the big image building block for instance) and set an image without url in the case where `o.url` was undefined, and the url of one of the records was also undefined. opw-692205
Diffstat (limited to 'addons/web_editor/static/src/js/widgets.js')
-rw-r--r--addons/web_editor/static/src/js/widgets.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js
index 3b08f8b89e2..077f497046c 100644
--- a/addons/web_editor/static/src/js/widgets.js
+++ b/addons/web_editor/static/src/js/widgets.js
@@ -299,7 +299,9 @@ var ImageDialog = Widget.extend({
self.display_attachments();
});
this.fetch_existing().then(function () {
- self.set_image(_.find(self.records, function (record) { return record.url === o.url;}) || o);
+ if (o.url) {
+ self.set_image(_.find(self.records, function (record) { return record.url === o.url;}) || o);
+ }
});
return res;
},