Make WordPress Core

Ticket #42321: 42321.patch

File 42321.patch, 1.2 KB (added by ashokrd2013, 7 years ago)

@welcher I have updated my patch as per your guideline.

  • 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-admin/nav-menus.php

     
    2727        );
    2828}
    2929
     30wp_enqueue_script( 'underscore' );
    3031wp_enqueue_script( 'nav-menu' );
    3132
    3233if ( wp_is_mobile() )