[FIX] website: do not duplicate iframes at each edition
Before this commit, when an user added a video in his page (an <iframe>) it was then duplicated each time the snippet in which the video is was edited and saved again, slowing the page loading. As the code responsible for that is quite outdated, it should be reviewed and refactored in master. This commit only fixes the problem with more code. This commit will also fix existing databases, if the user edit the video snippet once again. (Note: even if this commit's code will be even more strange in master, it *should* be forward-ported anyway).
This commit is contained in:
@@ -131,6 +131,10 @@ animation.registry.share = animation.Class.extend({
|
||||
animation.registry.media_video = animation.Class.extend({
|
||||
selector: ".media_iframe_video",
|
||||
start: function () {
|
||||
// TODO: this code should be refactored to make more sense and be better
|
||||
// integrated with Odoo (this refactoring should be done in master).
|
||||
this.$target.find('iframe').remove();
|
||||
|
||||
if (!this.$target.has('.media_iframe_video_size').length) {
|
||||
var editor = '<div class="css_editable_mode_display"> </div>';
|
||||
var size = '<div class="media_iframe_video_size"> </div>';
|
||||
|
||||
Reference in New Issue
Block a user