Make WordPress Core

Ticket #33404: 33404.diff

File 33404.diff, 2.2 KB (added by valendesigns, 8 years ago)
  • src/wp-admin/js/customize-nav-menus.js

    diff --git src/wp-admin/js/customize-nav-menus.js src/wp-admin/js/customize-nav-menus.js
    index e315019..e38f673 100644
     
    267267                                items.each( function( menuItem ) {
    268268                                        $content.append( itemTemplate( menuItem.attributes ) );
    269269                                } );
    270                                 if ( 20 > items.length ) {
    271                                         self.pages.search = -1; // Up to 20 posts and 20 terms in results, if <20, no more results for either.
     270                                if ( 10 > items.length ) {
     271                                        self.pages.search = -1; // Up to 10 posts and 10 terms in results, if <10, no more results for either.
    272272                                } else {
    273273                                        self.pages.search = self.pages.search + 1;
    274274                                }
     
    277277                                } else if ( items && page === 1 ) {
    278278                                        wp.a11y.speak( api.Menus.data.l10n.itemsFound.replace( '%d', items.length ) );
    279279                                }
     280
     281                                var totalHeight = $content.prop( 'scrollHeight' ),
     282                                        lastItem = $content.find( 'li' ).last();
     283
     284                                // The window is larger than the results and we need to initiate page 2 search.
     285                                if ( 1 === page && totalHeight > lastItem.position().top + lastItem.outerHeight( true ) ) {
     286                                        self.doSearch( 2 );
     287                                }
    280288                        });
    281289
    282290                        self.currentRequest.fail(function( data ) {
  • src/wp-includes/class-wp-customize-nav-menus.php

    diff --git src/wp-includes/class-wp-customize-nav-menus.php src/wp-includes/class-wp-customize-nav-menus.php
    index fb1633b..44b1f77 100644
    final class WP_Customize_Nav_Menus { 
    244244                        'update_post_term_cache' => false,
    245245                        'update_post_meta_cache' => false,
    246246                        'post_status'            => 'publish',
    247                         'posts_per_page'         => 20,
     247                        'posts_per_page'         => 10,
    248248                );
    249249
    250250                $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
    final class WP_Customize_Nav_Menus { 
    281281                $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
    282282                $terms = get_terms( $taxonomies, array(
    283283                        'name__like' => $args['s'],
    284                         'number'     => 20,
    285                         'offset'     => 20 * ($args['pagenum'] - 1),
     284                        'number'     => 10,
     285                        'offset'     => 10 * ($args['pagenum'] - 1),
    286286                ) );
    287287
    288288                // Check if any taxonomies were found.