In `wp.Uploader`, when `uploader:ready` is triggered, set `ready` to `true` on the instance. This allows media workflows to check for an existing uploaded instance when opening.

Without this check, workflows might wait for `uploader:ready`, which could already have been fired. This would result in an unresponsive editor dropzone.

Fixes #29689.


git-svn-id: https://develop.svn.wordpress.org/trunk@29917 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-10-16 05:53:15 +00:00
parent f0b35fe7d5
commit bd70f47d46
2 changed files with 9 additions and 3 deletions

View File

@ -3724,7 +3724,7 @@
}, },
drop: function( event ) { drop: function( event ) {
var $wrap = null; var $wrap = null, uploadView;
this.containerDragleave( event ); this.containerDragleave( event );
this.dropzoneDragleave( event ); this.dropzoneDragleave( event );
@ -3747,7 +3747,12 @@
title: wp.media.view.l10n.addMedia, title: wp.media.view.l10n.addMedia,
multiple: true multiple: true
}); });
this.workflow.on( 'uploader:ready', this.addFiles, this ); uploadView = this.workflow.uploader;
if ( uploadView.uploader && uploadView.uploader.ready ) {
this.addFiles.apply( this );
} else {
this.workflow.on( 'uploader:ready', this.addFiles, this );
}
} else { } else {
this.workflow.state().reset(); this.workflow.state().reset();
this.addFiles.apply( this ); this.addFiles.apply( this );

View File

@ -158,7 +158,8 @@ window.wp = window.wp || {};
dropzone.trigger('dropzone:leave').removeClass('drag-over'); dropzone.trigger('dropzone:leave').removeClass('drag-over');
}, 0 ); }, 0 );
}); });
self.ready = true;
$(self).trigger( 'uploader:ready' ); $(self).trigger( 'uploader:ready' );
}); });