Ticket #19845: 19845.8.diff
File 19845.8.diff, 3.5 KB (added by , 11 years ago) |
---|
-
src/wp-includes/js/media-views.js
3507 3507 3508 3508 this.$document.on( 'dragover', _.bind( this.containerDragover, this ) ); 3509 3509 this.$document.on( 'dragleave', _.bind( this.containerDragleave, this ) ); 3510 this.$document.on( 'click', '.wp-editor-wrap .uploader-editor', _.bind( this.hide, this ) ); 3510 3511 3511 3512 this.initialized = true; 3512 3513 return this; … … 3520 3521 return supports; 3521 3522 }, 3522 3523 3524 isDraggingFile: function( e ) { 3525 if ( _.isUndefined( e.originalEvent ) || _.isUndefined( e.originalEvent.dataTransfer ) ) { 3526 return false; 3527 } 3528 3529 return _.indexOf( e.originalEvent.dataTransfer.types, 'Files' ) > -1 && 3530 _.indexOf( e.originalEvent.dataTransfer.types, 'text/plain' ) === -1; 3531 }, 3532 3523 3533 refresh: function( e ) { 3524 3534 var dropzone_id; 3535 3525 3536 for ( dropzone_id in this.dropzones ) { 3526 3537 // Hide the dropzones only if dragging has left the screen. 3527 3538 this.dropzones[ dropzone_id ].toggle( this.overContainer || this.overDropzone ); … … 3556 3567 var $wrap = null; 3557 3568 3558 3569 this.files = event.originalEvent.dataTransfer.files; 3559 if ( this.files.length < 1 ) 3570 3571 if ( this.files.length < 1 ) { 3560 3572 return; 3573 } 3561 3574 3562 3575 this.containerDragleave( event ); 3563 3576 this.dropzoneDragleave( event ); … … 3593 3606 return this; 3594 3607 }, 3595 3608 3596 containerDragover: function() {3609 show: function() { 3597 3610 this.overContainer = true; 3598 3611 this.refresh(); 3599 3612 }, 3600 3613 3601 containerDragleave: function() {3614 hide: function() { 3602 3615 this.overContainer = false; 3616 this.overDropzone = false; 3617 this.refresh(); 3618 }, 3603 3619 3620 containerDragover: function( e, show ) { 3621 if ( show === 'show' ) { 3622 this.show(); 3623 return; 3624 } 3625 3626 if ( ! this.isDraggingFile( e ) ) { 3627 return; 3628 } 3629 3630 this.overContainer = true; 3631 this.refresh( e ); 3632 }, 3633 3634 containerDragleave: function( e ) { 3635 if ( ! this.isDraggingFile( e ) ) { 3636 return; 3637 } 3638 3639 this.overContainer = false; 3604 3640 // Throttle dragleave because it's called when bouncing from some elements to others. 3605 _.delay( _.bind( this.refresh, this ), 50 );3641 _.delay( _.bind( this.refresh, this, e ), 50 ); 3606 3642 }, 3607 3643 3608 3644 dropzoneDragover: function( e ) { 3645 if ( ! this.isDraggingFile( e ) ) { 3646 return; 3647 } 3648 3609 3649 this.overDropzone = true; 3610 3650 this.refresh( e ); 3611 3651 return false; … … 3612 3652 }, 3613 3653 3614 3654 dropzoneDragleave: function( e ) { 3655 if ( ! this.isDraggingFile( e ) ) { 3656 return; 3657 } 3658 3615 3659 this.overDropzone = false; 3616 3660 _.delay( _.bind( this.refresh, this, e ), 50 ); 3617 3661 } -
src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
376 376 }); 377 377 } 378 378 379 dom.bind( doc, 'dragover', function( event ) { 380 if ( typeof window.jQuery !== 'undefined' ) { 379 dom.bind( doc, 'dragenter', function( event ) { 380 if ( typeof window.jQuery !== 'undefined' && event.dataTransfer && 381 tinymce.inArray( event.dataTransfer.types, 'Files' ) > -1 && tinymce.inArray( event.dataTransfer.types, 'text/plain' ) === -1 ) { 381 382 // Propagate the event to its container for the parent window to catch. 382 window.jQuery( editor.getContainer() ).trigger( event);383 window.jQuery( editor.getContainer() ).trigger( 'dragover', 'show' ); 383 384 } 384 385 }); 385 386 });