Changeset 27531
- Timestamp:
- 03/14/2014 12:41:12 AM (11 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-views.js
r27530 r27531 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 … … 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 ) ); 3503 3504 this.$document.on( 'dragstart dragend drop', function( event ) { 3505 self.localDrag = event.type === 'dragstart'; 3506 }); 3496 3507 3497 3508 this.initialized = true; … … 3542 3553 var $wrap = null; 3543 3554 3544 this.files = event.originalEvent.dataTransfer.files;3545 if ( this.files.length < 1 )3546 return;3547 3548 3555 this.containerDragleave( event ); 3549 3556 this.dropzoneDragleave( event ); 3550 3557 3558 this.files = event.originalEvent.dataTransfer.files; 3559 if ( this.files.length < 1 ) { 3560 return; 3561 } 3562 3551 3563 // Set the active editor to the drop target. 3552 3564 $wrap = $( event.target ).parents( '.wp-editor-wrap' ); 3553 if ( $wrap.length > 0 ) {3565 if ( $wrap.length > 0 && $wrap[0].id ) { 3554 3566 window.wpActiveEditor = $wrap[0].id.slice( 3, -5 ); 3555 3567 } … … 3581 3593 3582 3594 containerDragover: function() { 3595 if ( this.localDrag ) { 3596 return; 3597 } 3598 3583 3599 this.overContainer = true; 3584 3600 this.refresh(); … … 3593 3609 3594 3610 dropzoneDragover: function( e ) { 3611 if ( this.localDrag ) { 3612 return; 3613 } 3614 3595 3615 this.overDropzone = true; 3596 3616 this.refresh( e ); … … 3601 3621 this.overDropzone = false; 3602 3622 _.delay( _.bind( this.refresh, this, e ), 50 ); 3623 }, 3624 3625 click: function( e ) { 3626 // In the rare case where the dropzone gets stuck, hide it on click. 3627 this.containerDragleave( e ); 3628 this.dropzoneDragleave( e ); 3629 this.localDrag = false; 3603 3630 } 3604 3631 }); -
trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
r27513 r27531 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 // Propagate the event to its container for the parent window to catch.385 window.jQuery( editor.getContainer() ).trigger( event);384 // Trigger the jQuery handlers. 385 window.jQuery( document ).triggerHandler( event.type ); 386 386 } 387 387 });
Note: See TracChangeset
for help on using the changeset viewer.