[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
This commit is contained in:
Romain Derie
2018-03-21 14:18:45 +01:00
parent d9869de690
commit 321486851a
@@ -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',