Improvements of Image format dropzone
* Limit drag-drop Image format zone to HTML5 runtime * Only keep the first file dropped * Only upload image files * Fix CSS for the progress bar props azaozz. see #24291. git-svn-id: http://core.svn.wordpress.org/trunk@24236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -59,16 +59,27 @@ window.wp = window.wp || {};
|
||||
'</div>'].join( '' ) );
|
||||
}
|
||||
|
||||
function imageFormatUploadFilesAdded( uploader, files ) {
|
||||
$.each( files, function( i, file ) {
|
||||
if ( i > 0 )
|
||||
uploader.removeFile(file);
|
||||
});
|
||||
}
|
||||
|
||||
var uploader = {
|
||||
dropzone: $('.wp-format-media-holder[data-format=image]'),
|
||||
success: imageFormatUploadSuccess,
|
||||
error: imageFormatUploadError,
|
||||
plupload: {},
|
||||
error: imageFormatUploadError,
|
||||
plupload: {
|
||||
runtimes: 'html5',
|
||||
filters: [ {title: 'Image', extensions: 'jpg,jpeg,gif,png'} ]
|
||||
},
|
||||
params: {}
|
||||
};
|
||||
uploader = new wp.Uploader( uploader );
|
||||
uploader.uploader.bind( 'BeforeUpload', imageFormatUploadStart );
|
||||
uploader.uploader.bind( 'UploadProgress', imageFormatUploadProgress );
|
||||
uploader.uploader.bind( 'FilesAdded', imageFormatUploadFilesAdded );
|
||||
|
||||
function switchFormatClass( format ) {
|
||||
formatField.val( format );
|
||||
|
||||
Reference in New Issue
Block a user