Make WordPress Core

Changeset 24236


Ignore:
Timestamp:
05/10/2013 06:49:05 PM (12 years ago)
Author:
markjaquith
Message:

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.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/wp-admin.css

    r24226 r24236  
    40624062    display: none;
    40634063}
     4064
    40644065.wp-format-media-holder.drag-over div {
    40654066    position: absolute;
     
    40734074
    40744075#poststuff .wp-format-media-holder.drag-over div h3 {
    4075 
    40764076    position: absolute;
    40774077    top: 50%;
     
    41124112}
    41134113
    4114 body.wp-format-image .attachment-display-settings {
    4115     display: none;
    4116 }
    4117 
     4114body.wp-format-image .attachment-display-settings,
    41184115body.wp-format-status #titlewrap,
    41194116body.wp-format-image .wp-media-buttons .insert-media,
     
    41254122}
    41264123
     4124.wp-format-media-select .media-progress-bar,
     4125.wp-format-media-select .media-progress-bar div,
    41274126.mejs-audio audio,
    41284127.mejs-video video {
  • trunk/wp-admin/js/post-formats.js

    r24226 r24236  
    6060    }
    6161
     62    function imageFormatUploadFilesAdded( uploader, files ) {
     63        $.each( files, function( i, file ) {
     64            if ( i > 0 )
     65                uploader.removeFile(file);
     66        });
     67    }
     68
    6269    var uploader = {
    6370        dropzone:  $('.wp-format-media-holder[data-format=image]'),
    6471        success:   imageFormatUploadSuccess,
    65         error: imageFormatUploadError,
    66         plupload:  {},
     72        error:     imageFormatUploadError,
     73        plupload:  {
     74            runtimes: 'html5',
     75            filters: [ {title: 'Image', extensions: 'jpg,jpeg,gif,png'} ]
     76        },
    6777        params:    {}
    6878    };
     
    7080    uploader.uploader.bind( 'BeforeUpload', imageFormatUploadStart );
    7181    uploader.uploader.bind( 'UploadProgress', imageFormatUploadProgress );
     82    uploader.uploader.bind( 'FilesAdded', imageFormatUploadFilesAdded );
    7283
    7384    function switchFormatClass( format ) {
Note: See TracChangeset for help on using the changeset viewer.