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:
parent
1bc98482f1
commit
57daea7230
@ -7874,7 +7874,7 @@ EditorUploader = View.extend({
|
|||||||
* @param {jQuery.Event} event The 'drop' event.
|
* @param {jQuery.Event} event The 'drop' event.
|
||||||
*/
|
*/
|
||||||
drop: function( event ) {
|
drop: function( event ) {
|
||||||
var $wrap = null, uploadView;
|
var $wrap, uploadView;
|
||||||
|
|
||||||
this.containerDragleave( event );
|
this.containerDragleave( event );
|
||||||
this.dropzoneDragleave( event );
|
this.dropzoneDragleave( event );
|
||||||
@ -7891,13 +7891,15 @@ EditorUploader = View.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( ! this.workflow ) {
|
if ( ! this.workflow ) {
|
||||||
this.workflow = wp.media.editor.open( 'content', {
|
this.workflow = wp.media.editor.open( window.wpActiveEditor, {
|
||||||
frame: 'post',
|
frame: 'post',
|
||||||
state: 'insert',
|
state: 'insert',
|
||||||
title: l10n.addMedia,
|
title: l10n.addMedia,
|
||||||
multiple: true
|
multiple: true
|
||||||
});
|
});
|
||||||
|
|
||||||
uploadView = this.workflow.uploader;
|
uploadView = this.workflow.uploader;
|
||||||
|
|
||||||
if ( uploadView.uploader && uploadView.uploader.ready ) {
|
if ( uploadView.uploader && uploadView.uploader.ready ) {
|
||||||
this.addFiles.apply( this );
|
this.addFiles.apply( this );
|
||||||
} else {
|
} else {
|
||||||
|
@ -128,7 +128,7 @@ EditorUploader = View.extend({
|
|||||||
* @param {jQuery.Event} event The 'drop' event.
|
* @param {jQuery.Event} event The 'drop' event.
|
||||||
*/
|
*/
|
||||||
drop: function( event ) {
|
drop: function( event ) {
|
||||||
var $wrap = null, uploadView;
|
var $wrap, uploadView;
|
||||||
|
|
||||||
this.containerDragleave( event );
|
this.containerDragleave( event );
|
||||||
this.dropzoneDragleave( event );
|
this.dropzoneDragleave( event );
|
||||||
@ -145,13 +145,15 @@ EditorUploader = View.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( ! this.workflow ) {
|
if ( ! this.workflow ) {
|
||||||
this.workflow = wp.media.editor.open( 'content', {
|
this.workflow = wp.media.editor.open( window.wpActiveEditor, {
|
||||||
frame: 'post',
|
frame: 'post',
|
||||||
state: 'insert',
|
state: 'insert',
|
||||||
title: l10n.addMedia,
|
title: l10n.addMedia,
|
||||||
multiple: true
|
multiple: true
|
||||||
});
|
});
|
||||||
|
|
||||||
uploadView = this.workflow.uploader;
|
uploadView = this.workflow.uploader;
|
||||||
|
|
||||||
if ( uploadView.uploader && uploadView.uploader.ready ) {
|
if ( uploadView.uploader && uploadView.uploader.ready ) {
|
||||||
this.addFiles.apply( this );
|
this.addFiles.apply( this );
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user