Changeset 27378
- Timestamp:
- 03/03/2014 05:43:33 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/edit.css
r27343 r27378 595 595 .edit-form-section { 596 596 margin-bottom: 20px; 597 } 598 599 .wp-editor-wrap { 597 600 position: relative; 598 601 } … … 605 608 width: 100%; 606 609 height: 100%; 607 z-index: 250000;610 z-index: 99998; /* under the toolbar */ 608 611 display: none; 609 612 text-align: center; -
trunk/src/wp-includes/js/media-views.js
r27363 r27378 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 var dropzone_id; 2827 for ( dropzone_id in this.dropzones ) { 2828 // Hide the dropzones only if dragging has left the screen. 2829 this.dropzones[ dropzone_id ].toggle( this.overContainer || this.overDropzone ); 2830 } 2831 return this; 2827 2832 }, 2828 2833 2829 2834 render: function() { 2830 2835 media.View.prototype.render.apply( this, arguments ); 2831 $( '. edit-form-section' ).append( this.$el);2836 $( '.wp-editor-wrap' ).each( _.bind( this.attach, this ) ); 2832 2837 return this; 2833 2838 }, 2834 2839 2840 attach: function( index, editor ) { 2841 // Attach a dropzone to an editor. 2842 var dropzone = this.$el.clone(); 2843 this.dropzones.push( dropzone ); 2844 $( editor ).append( dropzone ); 2845 return this; 2846 }, 2847 2835 2848 drop: function( event ) { 2849 var $wrap = null; 2850 2836 2851 this.files = event.originalEvent.dataTransfer.files; 2837 2852 if ( this.files.length < 1 ) 2838 2853 return; 2839 2854 2840 this.containerDragleave(); 2841 this.dropzoneDragleave(); 2855 this.containerDragleave( event ); 2856 this.dropzoneDragleave( event ); 2857 2858 // Set the active editor to the drop target. 2859 $wrap = $( event.target ).parents( '.wp-editor-wrap' ); 2860 if ( $wrap.length > 0 ) { 2861 window.wpActiveEditor = $wrap[0].id.slice( 3, -5 ); 2862 } 2842 2863 2843 2864 if ( ! this.workflow ) { … … 2878 2899 }, 2879 2900 2880 dropzoneDragover: function( ) {2881 this.$el.addClass( 'droppable' );2901 dropzoneDragover: function( e ) { 2902 $( e.target ).addClass( 'droppable' ); 2882 2903 this.overDropzone = true; 2883 2904 _.defer( _.bind( this.refresh, this ) ); … … 2885 2906 }, 2886 2907 2887 dropzoneDragleave: function( ) {2888 this.$el.removeClass( 'droppable' );2908 dropzoneDragleave: function( e ) { 2909 $( e.target ).removeClass( 'droppable' ); 2889 2910 this.overDropzone = false; 2890 2911 this.refresh();
Note: See TracChangeset
for help on using the changeset viewer.