Uploader & Theme Customizer: Refresh uploader flash/silverlight shims when the mouse enters the browse button. Add class to body based on uploader's drag/drop support. Properly assign customize image uploader containers (so flash shims are positioned correctly when scrolled). see #19910, #20452, #20582.

git-svn-id: http://core.svn.wordpress.org/trunk@20758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2012-05-09 21:26:19 +00:00
parent 7e3010ef46
commit 08e4e98c16
2 changed files with 16 additions and 5 deletions

View File

@ -138,9 +138,10 @@
this.success = $.proxy( this.success, this );
this.uploader = new wp.Uploader({
browser: this.container.find('.upload'),
dropzone: this.container.find('.upload-dropzone'),
success: this.success
container: this.container,
browser: this.container.find('.upload'),
dropzone: this.container.find('.upload-dropzone'),
success: this.success
});
this.remover = this.container.find('.remove');

View File

@ -2,6 +2,10 @@ if ( typeof wp === 'undefined' )
var wp = {};
(function( exports, $ ) {
var Uploader, body;
body = $( document.body );
/*
* An object that helps create a WordPress uploader using plupload.
*
@ -16,7 +20,7 @@ if ( typeof wp === 'undefined' )
*
* @param attributes - object - Attributes and methods for this specific instance.
*/
var Uploader = function( options ) {
Uploader = function( options ) {
var self = this,
elements = {
container: 'container',
@ -70,6 +74,9 @@ if ( typeof wp === 'undefined' )
this.uploader.init();
this.browser.on( 'mouseenter', this.refresh );
body.toggleClass( 'uploader-drag-drop', this.uploader.features.dragdrop );
this.uploader.bind( 'UploadProgress', this.progress );
this.uploader.bind( 'FileUploaded', function( up, file, response ) {
@ -160,7 +167,10 @@ if ( typeof wp === 'undefined' )
success: function() {},
added: function() {},
progress: function() {},
complete: function() {}
complete: function() {},
refresh: function() {
this.uploader.refresh();
}
});
exports.Uploader = Uploader;