From 321486851a6e50198ea1159ae1ed3a8e53a8ebb0 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Wed, 21 Mar 2018 13:02:50 +0100 Subject: [PATCH] [FIX] web_editor: correctly set image on double click Commit e011d58bee add the possibility to unselect images on the media dialog. But it introduced a collateral bug preventing double click to set the image. Indeed, double click event triggers not only the double click event but also twice the single click event. Before commit e011d58bee, it would work fine and as intented on double click: 1. It would trigger twice the single click, selecting twice the image. 2. Then, it would trigger the double click that would save the selected image. But after the commit: 1. It triggers twice the single click, selecting and then deselecting the image. 2. Then, it triggers the double click that saves nothing since the image got unselected on second single click event. Now, before saving on double click event, we select the image. task-1815165 --- addons/web_editor/static/src/js/widgets/widgets.js | 3 ++- 1 file changed, 2 insertions(+), 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 50759d3be0a..bff63edadce 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -111,7 +111,8 @@ var ImageDialog = Widget.extend({ 'change input.url': "change_input", 'keyup input.url': "change_input", 'click .existing-attachments [data-src]': 'select_existing', - 'dblclick .existing-attachments [data-src]': function () { + 'dblclick .existing-attachments [data-src]': function (e) { + this.select_existing(e); this.getParent().save(); }, 'click .o_existing_attachment_remove': 'try_remove',