summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorAntoine Guenet <age@odoo.com>2019-02-21 07:32:38 +0000
committerAntoine Guenet <age@odoo.com>2019-02-21 07:32:38 +0000
commit8b8d6d0a5b2ab6255f9fd3bec4284f371f1282c8 (patch)
tree098f071f3b80abc378b3faccc6f59b8d17c840f3 /addons/web_editor/static/src
parent5cec06b179f3dfe48c091f627d9e9c3255c30438 (diff)
[FIX] web_editor: do nothing on save if no media was selected in modal
When in the media modal, if one selected no media but clicked the "ADD" button it resulted in an error and a failed RPC instead of simply closing the modal without doing anything. v12 behavior is now restored. closes odoo/odoo#31308
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/plugin/media.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/media.js b/addons/web_editor/static/src/js/wysiwyg/plugin/media.js
index b4d484af805..e60cfbe8039 100644
--- a/addons/web_editor/static/src/js/wysiwyg/plugin/media.js
+++ b/addons/web_editor/static/src/js/wysiwyg/plugin/media.js
@@ -151,6 +151,9 @@ var MediaPlugin = AbstractPlugin.extend({
* @param {Object} data contains the media to insert
*/
insertMedia: function (previous, data) {
+ if (!data.media) {
+ return;
+ }
var newMedia = data.media;
this._wrapCommand(function () {
this.$editable.focus();