Fix error when dropping files for uploading on the editor before the media modal is initialized.

Props rommelxcastro, sebastiantiede. Fixes #32527.

git-svn-id: https://develop.svn.wordpress.org/trunk@32894 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-06-20 21:07:03 +00:00
parent 1bc98482f1
commit 57daea7230
2 changed files with 8 additions and 4 deletions

View File

@ -7874,7 +7874,7 @@ EditorUploader = View.extend({
* @param {jQuery.Event} event The 'drop' event.
*/
drop: function( event ) {
var $wrap = null, uploadView;
var $wrap, uploadView;
this.containerDragleave( event );
this.dropzoneDragleave( event );
@ -7891,13 +7891,15 @@ EditorUploader = View.extend({
}
if ( ! this.workflow ) {
this.workflow = wp.media.editor.open( 'content', {
this.workflow = wp.media.editor.open( window.wpActiveEditor, {
frame: 'post',
state: 'insert',
title: l10n.addMedia,
multiple: true
});
uploadView = this.workflow.uploader;
if ( uploadView.uploader && uploadView.uploader.ready ) {
this.addFiles.apply( this );
} else {

View File

@ -128,7 +128,7 @@ EditorUploader = View.extend({
* @param {jQuery.Event} event The 'drop' event.
*/
drop: function( event ) {
var $wrap = null, uploadView;
var $wrap, uploadView;
this.containerDragleave( event );
this.dropzoneDragleave( event );
@ -145,13 +145,15 @@ EditorUploader = View.extend({
}
if ( ! this.workflow ) {
this.workflow = wp.media.editor.open( 'content', {
this.workflow = wp.media.editor.open( window.wpActiveEditor, {
frame: 'post',
state: 'insert',
title: l10n.addMedia,
multiple: true
});
uploadView = this.workflow.uploader;
if ( uploadView.uploader && uploadView.uploader.ready ) {
this.addFiles.apply( this );
} else {