diff options
| author | Romain Derie <rde@odoo.com> | 2018-04-11 13:34:25 +0200 |
|---|---|---|
| committer | Romain Derie <rde@odoo.com> | 2018-04-11 15:02:11 +0200 |
| commit | 474f6cfdd8da71b3635389c097aa2a14bc5575a2 (patch) | |
| tree | 729129bfbd6363d448d6dd43ec0cd3018007a73c /addons/web_editor/static/src/js/widgets | |
| parent | 2d19c4c6b88ec75c3994af3a13ce467bb9d8e9f9 (diff) | |
[FIX] web_editor: changes lost on forward port of 744af2db
Fix of 744af2db that got lost during forward port, this is just rewriting the
diff for the new widget syntax.
Diffstat (limited to 'addons/web_editor/static/src/js/widgets')
| -rw-r--r-- | addons/web_editor/static/src/js/widgets/widgets.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js index 8a08c4e18f4..53df66e9ba7 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -455,11 +455,13 @@ var ImageWidget = MediaWidget.extend({ /** * @private */ - _toggleImage: function (attachment, clearSearch) { + _toggleImage: function (attachment, clearSearch, force_select) { if (this.multiImages) { var img = _.select(this.images, function (v) { return v.id === attachment.id; }); if (img.length) { - this.images.splice(this.images.indexOf(img[0]),1); + if (!force_select) { + this.images.splice(this.images.indexOf(img[0]),1); + } } else { this.images.push(attachment); } @@ -527,17 +529,18 @@ var ImageWidget = MediaWidget.extend({ /** * @private */ - _onImageClick: function (ev) { + _onImageClick: function (ev, force_select) { var $img = $(ev.currentTarget); var attachment = _.find(this.records, function (record) { return record.id === $img.data('id'); }); - this._toggleImage(attachment); + this._toggleImage(attachment, false, force_select); }, /** * @private */ _onImageDblClick: function (ev) { + this._onImageClick(ev, true); this.trigger_up('save_request'); }, /** |
