Make WordPress Core

Changeset 21630


Ignore:
Timestamp:
08/27/2012 10:20:23 PM (13 years ago)
Author:
koopersmith
Message:

Allow elements within a wp.Uploader dropzone to be repositioned when the drag-over class is added. fixes #21705.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/plupload/wp-plupload.js

    r21592 r21630  
    1212     *
    1313     * @param options - object - The options passed to the new plupload instance.
    14      *    Requires the following parameters:
     14     *    Accepts the following parameters:
    1515     *    - container - The id of uploader container.
    1616     *    - browser   - The id of button to trigger the file select.
     
    8787        // Generate drag/drop helper classes.
    8888        (function( dropzone, supported ) {
    89             var sensitivity = 50,
    90                 active;
     89            var timer, active;
    9190
    9291            if ( ! dropzone )
     
    101100            // simulate it with a limited 'dragover'
    102101            dropzone.bind( 'dragover.wp-uploader', function(){
     102                if ( timer )
     103                    clearTimeout( timer );
     104
    103105                if ( active )
    104106                    return;
     
    109111
    110112            dropzone.bind('dragleave.wp-uploader, drop.wp-uploader', function(){
    111                 active = false;
    112                 dropzone.removeClass('drag-over');
     113                // Using an instant timer prevents the drag-over class from
     114                // being quickly removed and re-added when elements inside the
     115                // dropzone are repositioned.
     116                //
     117                // See http://core.trac.wordpress.org/ticket/21705
     118                timer = setTimeout( function() {
     119                    active = false;
     120                    dropzone.removeClass('drag-over');
     121                }, 0 );
    113122            });
    114123        }( this.dropzone, this.supports.dragdrop ));
Note: See TracChangeset for help on using the changeset viewer.