Ticket #28750: 28750.patch
File 28750.patch, 2.7 KB (added by , 11 years ago) |
---|
-
src/wp-includes/js/media-views.js
4568 4568 this.model.on( 'change:title', this._syncTitle, this ); 4569 4569 this.model.on( 'change:caption', this._syncCaption, this ); 4570 4570 this.model.on( 'change:percent', this.progress, this ); 4571 this.model.on( 'change:preview', this.preview, this ); 4571 4572 4572 4573 // Update the selection. 4573 4574 this.model.on( 'add', this.select, this ); … … 4662 4663 this.$bar.width( this.model.get('percent') + '%' ); 4663 4664 } 4664 4665 }, 4666 4667 preview: function() { 4668 console.log( this.$el ); 4669 }, 4670 4665 4671 /** 4666 4672 * @param {Object} event 4667 4673 */ -
src/wp-includes/js/plupload/wp-plupload.js
174 174 175 175 this.uploader.bind( 'FilesAdded', function( up, files ) { 176 176 _.each( files, function( file ) { 177 var attributes, image; 177 var attributes, image, reader; 178 179 if ( window.FileReader ) { 180 reader = new FileReader(); 181 } 178 182 179 183 // Ignore failed uploads. 180 184 if ( plupload.FAILED === file.status ) { … … 201 205 // `jpeg`, `png` and `gif` are valid subtypes. 202 206 // `jpg` is not, so map it to `jpeg`. 203 207 attributes.subtype = ( 'jpg' === image[0] ) ? 'jpeg' : image[0]; 208 209 if ( reader ) { 210 reader.onload = function ( event ) { 211 $( reader ).trigger( 'preview', event.target.result ); 212 }; 213 214 reader.readAsDataURL( file.getNative() ); 215 } 204 216 } 205 217 206 218 // Create the `Attachment`. 207 219 file.attachment = wp.media.model.Attachment.create( attributes ); 208 220 221 reader && $( reader ).on( 'preview', function( event, preview ) { 222 file.attachment.set( { preview: preview } ); 223 }); 224 209 225 Uploader.queue.add( file.attachment ); 210 226 211 227 self.added( file.attachment ); -
src/wp-includes/media-template.php
393 393 <# } #> 394 394 <div class="attachment-preview type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}"> 395 395 <# if ( data.uploading ) { #> 396 <# if ( data.preview ) { #> 397 <div class="thumbnail"> 398 <div class="centered"> 399 <img src="{{ data.preview }}" draggable="false" alt="" style="opacity: 0.5" /> 400 </div> 401 </div> 402 <# } #> 396 403 <div class="media-progress-bar"><div></div></div> 397 404 <# } else if ( 'image' === data.type ) { #> 398 405 <div class="thumbnail">