From f616b2d20d4fbf364a1769b7b1a0cd6d12652bde Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 19 Dec 2016 13:50:07 +0100 Subject: [PATCH] [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 --- addons/web_editor/static/src/js/widgets.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; },