Image post format UI:

- When initializing wp.Uploader pass null for 'container' and 'browser'. Fixes a bug where another instance of the uploader was attached to <body>.
- Destroy the uploader instance if drag/drop is not supported (IE8 & 9).
See #24291.

git-svn-id: http://core.svn.wordpress.org/trunk@24310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2013-05-22 01:30:00 +00:00
parent d1ba0654c9
commit fe8c363c38
1 changed files with 11 additions and 3 deletions

View File

@ -67,6 +67,8 @@ window.wp = window.wp || {};
}
var uploader = {
container: null,
browser: null,
dropzone: $('.wp-format-media-holder[data-format=image]'),
success: imageFormatUploadSuccess,
error: imageFormatUploadError,
@ -77,9 +79,15 @@ window.wp = window.wp || {};
params: {}
};
uploader = new wp.Uploader( uploader );
uploader.uploader.bind( 'BeforeUpload', imageFormatUploadStart );
uploader.uploader.bind( 'UploadProgress', imageFormatUploadProgress );
uploader.uploader.bind( 'FilesAdded', imageFormatUploadFilesAdded );
if ( uploader.supports.dragdrop ) {
uploader.uploader.bind( 'BeforeUpload', imageFormatUploadStart );
uploader.uploader.bind( 'UploadProgress', imageFormatUploadProgress );
uploader.uploader.bind( 'FilesAdded', imageFormatUploadFilesAdded );
} else {
uploader.uploader.destroy();
uploader = null;
}
function switchFormatClass( format ) {
formatField.val( format );