summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2018-01-11 14:10:27 +0100
committerRomain Derie <rde@odoo.com>2018-01-12 10:48:42 +0100
commitbd00fa8dd1808478e70232dfcbd2f4b48f9e1cc8 (patch)
tree2b18fb817a6e76378a859f19003b91764ac3acda /addons
parent270b2ebf81036439b0b0e61fb32e737f98885001 (diff)
[FIX] web_editor: dbclick a video open MediaDialog with wrong media
Before this commit: In the web editor, if you double clicked on a video iframe to edit it, it would open the MediaDialog(media) with the wrong media element. Media would be '&nbsp;' instead of '.media_iframe_video' (which is its grand parent): div.media_iframe_video div.css_editable_mode_display '& nbsp;' Then, if you changed the media by another one (Image or Video), the media would be wrongly inserted into the DOM, in the already existing iframe, eg: (1) div.media_iframe_video (2) div.css_editable_mode_display (3) div.media_iframe_video (4) div.css_editable_mode_display (5) ' &nbsp;' Since the new media (3) is wrongly instered into (2) instead of replacing (1), the bug it would not be visible on normal mode (you would still see the old media) because (2) is not displayed on normal mode. Then on edit mode you would see both media one over the other. Note: This only happened when you opened MediaDialog thought double click directly (not 'Edit 'in navbar) and without clicking somewhere else after you entered edit mode. Now, if the media has an iframe parent, we use that parent as the correct media This closes #22109, closes #22179 Courtesy of QSM for the help
Diffstat (limited to 'addons')
-rw-r--r--addons/web_editor/static/src/js/rte.summernote.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js
index 866d0d68e84..5f28c9510bb 100644
--- a/addons/web_editor/static/src/js/rte.summernote.js
+++ b/addons/web_editor/static/src/js/rte.summernote.js
@@ -398,7 +398,9 @@ eventHandler.modules.imageDialog.showImageDialog = function ($editable) {
if (r.sc.tagName && r.sc.childNodes.length) {
r.sc = r.sc.childNodes[r.so];
}
- new widgets.MediaDialog(null, {}, $editable, dom.isImg(r.sc) ? r.sc : null).open();
+ new widgets.MediaDialog(null, {}, $editable, $(r.sc).parents().addBack().filter(function (i, el) {
+ return dom.isImg(el);
+ })[0]).open();
return new $.Deferred().reject();
};
$.summernote.pluginEvents.alt = function (event, editor, layoutInfo, sorted) {