[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
This commit is contained in:
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user