[FIX] web_editor, website_forum: allow to post videos on the forum

The commit 8749410b10 corrected the way the iframe was rendered to display a video in v9.0.
In v10 though, the html sanitizer is a bit more severe and cleans data-src attributes, preventing the iframe to have a src

This commit works around that and allows the src of the video to be saved in db

OPW 761424

closes #19125
This commit is contained in:
Lucas Perais (lpe)
2017-09-06 13:52:03 +02:00
parent 8fd5951fbe
commit 45e0cd564a
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -915,7 +915,7 @@ var VideoDialog = Widget.extend({
video_id = this.$("#video_id").val();
}
var $iframe = $(
'<div class="media_iframe_video" data-src="'+this.$iframe.attr("src")+'">'+
'<div class="media_iframe_video" data-oe-expression="'+this.$iframe.attr("src")+'">'+
'<div class="css_editable_mode_display">&nbsp;</div>'+
'<div class="media_iframe_video_size" contentEditable="false">&nbsp;</div>'+
'<iframe src="'+this.$iframe.attr("src")+'" frameborder="0" allowfullscreen="allowfullscreen" contentEditable="false"></iframe>'+
@@ -127,7 +127,8 @@ animation.registry.media_video = animation.Class.extend({
var size = '<div class="media_iframe_video_size">&nbsp;</div>';
this.$target.html(editor+size);
}
this.$target.html(this.$target.html()+'<iframe src="'+_.escape(this.$target.data("src"))+'" frameborder="0" allowfullscreen="allowfullscreen"></iframe>');
// rebuilding the iframe, from https://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/
this.$target.html(this.$target.html()+'<iframe sandbox="allow-scripts allow-same-origin" src="'+_.escape(this.$target.data("oe-expression"))+'" frameborder="0" allowfullscreen="allowfullscreen"></iframe>');
},
});