[wp-trac] [WordPress Trac] #31547: Drag and drop feature in the editor not working correctly.
WordPress Trac
noreply at wordpress.org
Fri Mar 6 03:32:51 UTC 2015
#31547: Drag and drop feature in the editor not working correctly.
----------------------------------------+-----------------------------
Reporter: msaggiorato | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Upload | Version: 4.1.1
Severity: normal | Keywords:
Focuses: javascript, administration |
----------------------------------------+-----------------------------
I've just run into this issue, and after some research i found out that
the drag and drop feature opens the media view to append it's results to
the "content" editor. which may or may not be available.
I've fixed this locally by doing some duck punching on the
wp.media.editor.open function and checking if the targeted id actually
exists in among the tinymce editors.
But this could be all avoided if in this file
https://core.trac.wordpress.org/browser/trunk/src/wp-
includes/js/media/views.js#L8042
You just check if there's already an active editor, and if not, then
default to "content".
Here's the code i used to fix this in my install, but i would love if this
gets fixed in some future release.
{{{
var oldMediaEditorOpen = wp.media.editor.open;
wp.media.editor.open = function(id, options){
if(typeof tinymce.editors[id] === "undefined"){
if(typeof tinyMCE.activeEditor.id !== "undefined")
id = tinyMCE.activeEditor.id
}
return oldMediaEditorOpen.apply(this, [id, options]);
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31547>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list