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 aa4467a5ee4..0e700e18ec6 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/media.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/media.js @@ -1276,15 +1276,16 @@ var VideoWidget = MediaWidget.extend({ */ save: function () { this._updateVideo(); + const videoSrc = this.$content.attr('src'); if (this.isForBgVideo) { - return Promise.resolve({bgVideoSrc: this.$content.attr('src')}); + return Promise.resolve({bgVideoSrc: videoSrc}); } - if (this.$('.o_video_dialog_iframe').is('iframe')) { + if (this.$('.o_video_dialog_iframe').is('iframe') && videoSrc) { this.$media = $( - '
' + + '
' + '
 
' + '
 
' + - '' + + '' + '
' ); this.media = this.$media[0]; diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 387f2f2bfa9..4d3b3681cfe 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -849,6 +849,9 @@ const Wysiwyg = Widget.extend({ const restoreSelection = preserveCursor(this.odooEditor.document); linkDialog.open(); linkDialog.on('save', this, data => { + if (!data) { + return; + } const linkWidget = linkDialog.linkWidget; getDeepRange(this.$editable[0], {range: data.range, select: true}); if (!linkWidget.$link.length) { @@ -918,6 +921,9 @@ const Wysiwyg = Widget.extend({ mediaDialog.open(); mediaDialog.on('save', this, function (element) { + if (!element) { + return; + } // restore saved html classes if (params.htmlClass) { element.className += " " + params.htmlClass;