Make WordPress Core

Ticket #42321: 42321.1.patch

File 42321.1.patch, 1.7 KB (added by ashokrd2013, 7 years ago)

@welcher updated my patch

  • src/wp-admin/js/nav-menu.js

     
    829829                                        }
    830830                                }
    831831                        });
     832                        $( '#menu-name' ).on('keyup', _.debounce(function (e) {
     833                                menuName = $( document.getElementById( 'menu-name' ) );
     834                                menuNameVal = menuName.val();
     835                                if ( ! menuNameVal || menuNameVal == menuName.attr( 'title' ) || ! menuNameVal.replace( /\s+/, '' ) ) {
     836                                        // Add warning for invalid menu name
     837                                        menuName.parent().addClass( 'form-invalid' );
     838                                } else {
     839                                        // Remove warning for valid menu name
     840                                        menuName.parent().removeClass( 'form-invalid' );
     841                                }
     842                        }, 500));
    832843                        $('#add-custom-links input[type="text"]').keypress(function(e){
    833844                                $('#customlinkdiv').removeClass('form-invalid');
    834845
  • src/wp-includes/script-loader.php

     
    874874                ) );
    875875
    876876                // Navigation Menus
    877                 $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'json2' ) );
     877                $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'json2', 'underscore' ) );
    878878                did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(
    879879                        'noResultsFound' => __( 'No results found.' ),
    880880                        'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),