WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#31547 closed defect (bug) (duplicate)

Drag and drop feature in the editor not working correctly.

Reported by: msaggiorato Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1.1
Component: TinyMCE Keywords:
Focuses: javascript, administration Cc:
PR Number:

Description

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]);
}

Change History (3)

#1 @DrewAPicture
5 years ago

  • Component changed from Upload to TinyMCE

#2 @rommelxcastro
4 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #32527.

thi has been already fixed on [32894]

#3 @iseulde
4 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.