From 9e6f3abead075bf511ba52cf654e776d04b1d3d5 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 31 May 2019 13:06:50 +0000 Subject: [PATCH] [FIX] web_editor: image modal nochange close on save When you open the image modal of the website editor the selected image is the current image. But if the image is not an attachment with an `url` field set (eg. it has been uploaded and is not a file in a /static/ folder) the match between image modal and current did not work and to close it we need to: - actively select the current image then click "Save" - use the X button to close the modal without saving With this changeset, the match of current image with image list is done on the attachment `url` and if unavailable with /web/image/ID/name.jpg path which cover both possibilities. opw-2004073 closes #33799 Signed-off-by: Nicolas Lempereur (nle) --- addons/web_editor/static/src/js/widgets/widgets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js index 43bc2e95199..8e5e0787369 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -255,7 +255,7 @@ var ImageWidget = MediaWidget.extend({ o.id = +o.url.match(/\/web\/content\/(\d+)/, '')[1]; } if (o.url) { - self._toggleImage(_.find(self.records, function (record) { return record.url === o.url;}) || o, true); + self._toggleImage(_.find(self.records, function (record) { return record.src === o.url;}) || o, true); } return def;