Ticket #27423: 27423.24.patch
File 27423.24.patch, 3.8 KB (added by , 10 years ago) |
---|
-
src/wp-includes/css/media-views.css
2511 2511 } 2512 2512 } 2513 2513 2514 . attachments[data-columns="1"] .attachment {2514 .media-frame-content[data-columns="1"] .attachment { 2515 2515 width: 100%; 2516 2516 } 2517 2517 2518 . attachments[data-columns="2"] .attachment {2518 .media-frame-content[data-columns="2"] .attachment { 2519 2519 width: 50%; 2520 2520 } 2521 2521 2522 . attachments[data-columns="3"] .attachment {2522 .media-frame-content[data-columns="3"] .attachment { 2523 2523 width: 33.3%; 2524 2524 } 2525 2525 2526 . attachments[data-columns="4"] .attachment {2526 .media-frame-content[data-columns="4"] .attachment { 2527 2527 width: 25%; 2528 2528 } 2529 2529 2530 . attachments[data-columns="5"] .attachment {2530 .media-frame-content[data-columns="5"] .attachment { 2531 2531 width: 20%; 2532 2532 } 2533 2533 2534 . attachments[data-columns="6"] .attachment {2534 .media-frame-content[data-columns="6"] .attachment { 2535 2535 width: 16.6%; 2536 2536 } 2537 2537 2538 . attachments[data-columns="7"] .attachment {2538 .media-frame-content[data-columns="7"] .attachment { 2539 2539 width: 14.2%; 2540 2540 } 2541 2541 2542 . attachments[data-columns="8"] .attachment {2542 .media-frame-content[data-columns="8"] .attachment { 2543 2543 width: 12.5%; 2544 2544 } 2545 2545 2546 . attachments[data-columns="9"] .attachment {2546 .media-frame-content[data-columns="9"] .attachment { 2547 2547 width: 11.1%; 2548 2548 } 2549 2549 2550 . attachments[data-columns="10"] .attachment {2550 .media-frame-content[data-columns="10"] .attachment { 2551 2551 width: 10%; 2552 2552 } 2553 2553 2554 . attachments[data-columns="11"] .attachment {2554 .media-frame-content[data-columns="11"] .attachment { 2555 2555 width: 9%; 2556 2556 } 2557 2557 2558 . attachments[data-columns="12"] .attachment {2558 .media-frame-content[data-columns="12"] .attachment { 2559 2559 width: 8.3%; 2560 2560 } -
src/wp-includes/js/media-views.js
5199 5199 }); 5200 5200 5201 5201 this._viewsByCid = {}; 5202 this.$window = $( window ); 5203 this.resizeEvent = 'resize.media-modal-columns'; 5202 5204 5203 5205 this.collection.on( 'add', function( attachment ) { 5204 5206 this.views.add( this.createAttachmentView( attachment ), { … … 5230 5232 _.bindAll( this, 'setColumns' ); 5231 5233 5232 5234 if ( this.options.resize ) { 5233 $( window ).on( 'resize.media-modal-columns', this.setColumns );5235 this.on( 'ready', this.bindEvents ); 5234 5236 this.controller.on( 'open', this.setColumns ); 5237 5238 // Call this.setColumns() after this view has been rendered in the DOM so 5239 // attachments get proper width applied. 5240 _.defer( this.setColumns, this ); 5235 5241 } 5242 }, 5236 5243 5237 // Call this.setColumns() after this view has been rendered in the DOM so 5238 // attachments get proper width applied. 5239 _.defer( this.setColumns, this ); 5244 bindEvents: function() { 5245 this.$window.off( this.resizeEvent ).on( this.resizeEvent, _.debounce( this.setColumns, 50 ) ); 5240 5246 }, 5241 5247 5242 5248 attachmentFocus: function() { … … 5249 5255 5250 5256 arrowEvent: function( event ) { 5251 5257 var attachments = this.$el.children( 'li' ), 5252 perRow = this. $el.data( 'columns' ),5258 perRow = this.columns, 5253 5259 index = attachments.filter( ':focus' ).index(), 5254 5260 row = ( index + 1 ) <= perRow ? 1 : Math.ceil( ( index + 1 ) / perRow ); 5255 5261 … … 5292 5298 5293 5299 dispose: function() { 5294 5300 this.collection.props.off( null, null, this ); 5295 $( window ).off( 'resize.media-modal-columns' ); 5301 if ( this.options.resize ) { 5302 this.$window.off( this.resizeEvent ); 5303 } 5296 5304 5297 5305 /** 5298 5306 * call 'dispose' directly on the parent class … … 5308 5316 this.columns = Math.min( Math.round( width / this.options.idealColumnWidth ), 12 ) || 1; 5309 5317 5310 5318 if ( ! prev || prev !== this.columns ) { 5311 this.$el. attr( 'data-columns', this.columns );5319 this.$el.closest( '.media-frame-content' ).attr( 'data-columns', this.columns ); 5312 5320 } 5313 5321 } 5314 5322 },