Make WordPress Core

Ticket #29304: 29304-01.patch

File 29304-01.patch, 1.4 KB (added by gcorne, 11 years ago)
  • src/wp-includes/js/media-views.js

    diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
    index 808c8d0..d995691 100644
     
    52535253                        this.collection.on( 'reset', this.render, this );
    52545254
    52555255                        this.listenTo( this.controller, 'library:selection:add',    this.attachmentFocus );
    5256                         this.listenTo( this.controller, 'attachment:keydown:arrow', this.arrowEvent );
    52575256
    52585257                        // Throttle the scroll handler and bind this.
    52595258                        this.scroll = _.chain( this.scroll ).bind( this ).throttle( this.options.refreshSensitivity ).value();
     
    52815280
    52825281                arrowEvent: function( event ) {
    52835282                        var attachments = this.$el.children( 'li' ),
    5284                                 perRow = Math.round( this.$el.width() / attachments.first().outerWidth() ),
     5283                                perRow = this.$el.data( 'columns' ),
    52855284                                index = attachments.filter( ':focus' ).index(),
    52865285                                row = ( index + 1 ) <= perRow ? 1 : Math.ceil( ( index + 1 ) / perRow );
    52875286
     5287                        if ( index === -1 && this.options.selection.single() ) {
     5288                                index = this.collection.indexOf( this.options.selection.single() );
     5289                        }
     5290
    52885291                        // Left arrow
    52895292                        if ( 37 === event.keyCode ) {
    52905293                                if ( 0 === index ) {
     
    60016004                                AttachmentView: this.options.AttachmentView
    60026005                        });
    60036006
     6007                        this.attachments.listenTo( this.controller, 'attachment:keydown:arrow', this.attachments.arrowEvent );
     6008
    60046009                        this.views.add( this.attachments );
    60056010
    60066011