summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-11-27 15:34:24 +0100
committerqsm-odoo <qsm@odoo.com>2017-11-28 10:03:27 +0100
commit6d2bf44fee76a8b73ebad206cd7a283c88b6c4ef (patch)
tree72a2f5b8f99d6dd7bca5558097d4aaacb715765e /addons
parent11ae103e122a2ed4f31be5e18154d4692e4be177 (diff)
[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).
Diffstat (limited to 'addons')
-rw-r--r--addons/website/static/src/js/website.snippets.animation.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/website/static/src/js/website.snippets.animation.js b/addons/website/static/src/js/website.snippets.animation.js
index 644b6b3aa1c..c3382d565bd 100644
--- a/addons/website/static/src/js/website.snippets.animation.js
+++ b/addons/website/static/src/js/website.snippets.animation.js
@@ -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">&nbsp;</div>';
var size = '<div class="media_iframe_video_size">&nbsp;</div>';