Customizer: Trim whitespace from custom link URLs.
This complements a similar fix for the Menus screen in [45655]. Props donmhico, audrasjb. Merges [45869] to the 5.2 branch. Fixes #47888. See #47723. Built from https://develop.svn.wordpress.org/branches/5.2@45870 git-svn-id: http://core.svn.wordpress.org/branches/5.2@45681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7a64dfb557
commit
6b8460ee43
|
@ -544,6 +544,7 @@
|
||||||
var menuItem,
|
var menuItem,
|
||||||
itemName = $( '#custom-menu-item-name' ),
|
itemName = $( '#custom-menu-item-name' ),
|
||||||
itemUrl = $( '#custom-menu-item-url' ),
|
itemUrl = $( '#custom-menu-item-url' ),
|
||||||
|
url = itemUrl.val().trim(),
|
||||||
urlRegex;
|
urlRegex;
|
||||||
|
|
||||||
if ( ! this.currentMenuControl ) {
|
if ( ! this.currentMenuControl ) {
|
||||||
|
@ -567,14 +568,14 @@
|
||||||
if ( '' === itemName.val() ) {
|
if ( '' === itemName.val() ) {
|
||||||
itemName.addClass( 'invalid' );
|
itemName.addClass( 'invalid' );
|
||||||
return;
|
return;
|
||||||
} else if ( ! urlRegex.test( itemUrl.val() ) ) {
|
} else if ( ! urlRegex.test( url ) ) {
|
||||||
itemUrl.addClass( 'invalid' );
|
itemUrl.addClass( 'invalid' );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
menuItem = {
|
menuItem = {
|
||||||
'title': itemName.val(),
|
'title': itemName.val(),
|
||||||
'url': itemUrl.val(),
|
'url': url,
|
||||||
'type': 'custom',
|
'type': 'custom',
|
||||||
'type_label': api.Menus.data.l10n.custom_label,
|
'type_label': api.Menus.data.l10n.custom_label,
|
||||||
'object': 'custom'
|
'object': 'custom'
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -944,7 +944,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
addCustomLink : function( processMethod ) {
|
addCustomLink : function( processMethod ) {
|
||||||
var url = $('#custom-menu-item-url').val(),
|
var url = $('#custom-menu-item-url').val().trim(),
|
||||||
label = $('#custom-menu-item-name').val();
|
label = $('#custom-menu-item-name').val();
|
||||||
|
|
||||||
processMethod = processMethod || api.addMenuItemToBottom;
|
processMethod = processMethod || api.addMenuItemToBottom;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.2.3-alpha-45868';
|
$wp_version = '5.2.3-alpha-45870';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue