Ticket #19845: 19845.9.diff
File 19845.9.diff, 3.0 KB (added by , 11 years ago) |
---|
-
src/wp-includes/js/media-views.js
3475 3475 className: 'uploader-editor', 3476 3476 template: media.template( 'uploader-editor' ), 3477 3477 3478 localDrag: false, 3479 overContainer: false, 3480 overDropzone: false, 3481 3478 3482 initialize: function() { 3483 var self = this; 3484 3479 3485 this.initialized = false; 3480 3486 3481 3487 // Bail if UA does not support drag'n'drop or File API. … … 3490 3496 this.$document.on( 'drop', '.uploader-editor', _.bind( this.drop, this ) ); 3491 3497 this.$document.on( 'dragover', '.uploader-editor', _.bind( this.dropzoneDragover, this ) ); 3492 3498 this.$document.on( 'dragleave', '.uploader-editor', _.bind( this.dropzoneDragleave, this ) ); 3499 this.$document.on( 'click', '.uploader-editor', _.bind( this.click, this ) ); 3493 3500 3494 3501 this.$document.on( 'dragover', _.bind( this.containerDragover, this ) ); 3495 3502 this.$document.on( 'dragleave', _.bind( this.containerDragleave, this ) ); 3496 3503 3504 this.$document.on( 'dragstart', function() { 3505 self.localDrag = true; 3506 }); 3507 3508 this.$document.on( 'dragend drop', function() { 3509 self.localDrag = false; 3510 }); 3511 3497 3512 this.initialized = true; 3498 3513 return this; 3499 3514 }, … … 3541 3556 drop: function( event ) { 3542 3557 var $wrap = null; 3543 3558 3559 this.containerDragleave( event ); 3560 this.dropzoneDragleave( event ); 3561 3544 3562 this.files = event.originalEvent.dataTransfer.files; 3545 3563 if ( this.files.length < 1 ) 3546 3564 return; 3547 3565 3548 this.containerDragleave( event );3549 this.dropzoneDragleave( event );3550 3551 3566 // Set the active editor to the drop target. 3552 3567 $wrap = $( event.target ).parents( '.wp-editor-wrap' ); 3553 3568 if ( $wrap.length > 0 ) { … … 3580 3595 }, 3581 3596 3582 3597 containerDragover: function() { 3598 if ( this.localDrag ) { 3599 return; 3600 } 3601 3583 3602 this.overContainer = true; 3584 3603 this.refresh(); 3585 3604 }, … … 3592 3611 }, 3593 3612 3594 3613 dropzoneDragover: function( e ) { 3614 if ( this.localDrag ) { 3615 return; 3616 } 3617 3595 3618 this.overDropzone = true; 3596 3619 this.refresh( e ); 3597 3620 return false; … … 3600 3623 dropzoneDragleave: function( e ) { 3601 3624 this.overDropzone = false; 3602 3625 _.delay( _.bind( this.refresh, this, e ), 50 ); 3626 }, 3627 3628 click: function( e ) { 3629 // In the rare case where the dropzone gets stuck, hide it on click. 3630 this.containerDragleave( e ); 3631 this.dropzoneDragleave( e ); 3603 3632 } 3604 3633 }); 3605 3634 -
src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
379 379 }); 380 380 } 381 381 382 dom.bind( doc, 'drag over', function( event ) {382 dom.bind( doc, 'dragstart dragend dragover drop', function( event ) { 383 383 if ( typeof window.jQuery !== 'undefined' ) { 384 384 // Propagate the event to its container for the parent window to catch. 385 385 window.jQuery( editor.getContainer() ).trigger( event );