From dfcfca15d57f0c7170d45f4b483c5886edfe7aa2 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Thu, 17 Sep 2020 07:44:43 +0000 Subject: [PATCH] [FIX] web_editor: don't reoptimize already optimized image if repicked Previously, if you double-clicked an image in the web editor with the intention to change it, but the image had already been optimized, and then repicked the same, already optimized image, the image would be optimized again even though it had not changed. This commit fixes that by making the media-dialog not trigger an image_changed event in those cases, and by leaving the initial image untouched. Linked to issue #57604 closes odoo/odoo#64038 X-original-commit: 4d3655304205cc9785ef696a47a17a41242d297a Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/wysiwyg/widgets/media.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/media.js b/addons/web_editor/static/src/js/wysiwyg/widgets/media.js index a76a3af9d8e..80e8bd998fb 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/media.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/media.js @@ -418,7 +418,7 @@ var FileWidget = SearchableMediaWidget.extend({ } const img = selected[0]; - if (!img || !img.id) { + if (!img || !img.id || this.$media.attr('src') === img.image_src) { return this.media; }