Ticket #19845: 19845.4.diff
File 19845.4.diff, 3.4 KB (added by , 11 years ago) |
---|
-
src/wp-admin/css/edit.css
594 594 595 595 .edit-form-section { 596 596 margin-bottom: 20px; 597 } 598 599 .wp-editor-wrap { 597 600 position: relative; 598 601 } 599 602 … … 604 607 left: 0; 605 608 width: 100%; 606 609 height: 100%; 607 z-index: 250000;610 z-index: 99998; 608 611 display: none; 609 612 text-align: center; 610 613 } -
src/wp-includes/js/media-views.js
2807 2807 className: 'uploader-editor', 2808 2808 template: media.template( 'uploader-editor' ), 2809 2809 2810 events: {2811 'drop': 'drop',2812 'dragover': 'dropzoneDragover',2813 'dragleave': 'dropzoneDragleave'2814 },2815 2816 2810 initialize: function() { 2811 this.$document = $(document); 2812 this.dropzones = []; 2817 2813 this.files = []; 2818 this.$document = $(document); 2814 2815 this.$document.on( 'drop', '.uploader-editor', _.bind( this.drop, this ) ); 2816 this.$document.on( 'dragover', '.uploader-editor', _.bind( this.dropzoneDragover, this ) ); 2817 this.$document.on( 'dragleave', '.uploader-editor', _.bind( this.dropzoneDragleave, this ) ); 2818 2819 2819 this.$document.on( 'dragover', _.bind( this.containerDragover, this ) ); 2820 2820 this.$document.on( 'dragleave', _.bind( this.containerDragleave, this ) ); 2821 2821 2822 return this; 2822 2823 }, 2823 2824 2824 2825 refresh: function() { 2825 // Hide the dropzone only if dragging has left the screen. 2826 return this.$el.toggle( this.overContainer || this.overDropzone ); 2826 for ( dropzone_id in this.dropzones ) { 2827 // Hide the dropzones only if dragging has left the screen. 2828 this.dropzones[ dropzone_id ].toggle( this.overContainer || this.overDropzone ); 2829 } 2830 return this; 2827 2831 }, 2828 2832 2829 2833 render: function() { 2830 2834 media.View.prototype.render.apply( this, arguments ); 2831 $( '. edit-form-section' ).append( this.$el);2835 $( '.wp-editor-wrap' ).each( _.bind( this.attach, this ) ); 2832 2836 return this; 2833 2837 }, 2834 2838 2839 attach: function( index, editor ) { 2840 // Attach a dropzone to an editor. 2841 var dropzone = this.$el.clone(); 2842 this.dropzones.push( dropzone ); 2843 $( editor ).append( dropzone ); 2844 return this; 2845 }, 2846 2835 2847 drop: function( event ) { 2848 var $wrap = null; 2849 2836 2850 this.files = event.originalEvent.dataTransfer.files; 2837 2851 if ( this.files.length < 1 ) 2838 2852 return; 2839 2853 2840 this.containerDragleave( );2841 this.dropzoneDragleave( );2854 this.containerDragleave( event ); 2855 this.dropzoneDragleave( event ); 2842 2856 2857 // Set the active editor to the drop target. 2858 $wrap = $( event.target ).parents( '.wp-editor-wrap' ); 2859 if ( $wrap.length > 0 ) { 2860 window.wpActiveEditor = $wrap[0].id.slice( 3, -5 ); 2861 } 2862 2843 2863 if ( ! this.workflow ) { 2844 2864 this.workflow = wp.media.editor.open( 'content', { 2845 2865 frame: 'post', … … 2877 2897 _.delay( _.bind( this.refresh, this ), 50 ); 2878 2898 }, 2879 2899 2880 dropzoneDragover: function( ) {2881 this.$el.addClass( 'droppable' );2900 dropzoneDragover: function( e ) { 2901 $( e.target ).addClass( 'droppable' ); 2882 2902 this.overDropzone = true; 2883 2903 _.defer( _.bind( this.refresh, this ) ); 2884 2904 return false; 2885 2905 }, 2886 2906 2887 dropzoneDragleave: function( ) {2888 this.$el.removeClass( 'droppable' );2907 dropzoneDragleave: function( e ) { 2908 $( e.target ).removeClass( 'droppable' ); 2889 2909 this.overDropzone = false; 2890 2910 this.refresh(); 2891 2911 }