[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 ' ' 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) ' '
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
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user