wpLink: fix the logic for prepending http:// and trim the input.
Props iseulde. See #18149. Built from https://develop.svn.wordpress.org/trunk@31606 git-svn-id: http://core.svn.wordpress.org/trunk@31587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -73,16 +73,20 @@ var wpLink;
|
||||
}, 500 );
|
||||
});
|
||||
|
||||
inputs.url.on( 'paste blur', function() {
|
||||
setTimeout( function() {
|
||||
var url = $.trim( inputs.url.val() );
|
||||
function correctURL() {
|
||||
var url = $.trim( inputs.url.val() );
|
||||
|
||||
if ( url && correctedURL !== url && ! /^(?:[a-z]+:|#|\?|\.|\/)/.test( url ) ) {
|
||||
inputs.url.val( 'http://' + url );
|
||||
correctedURL = url;
|
||||
}
|
||||
}, 0 );
|
||||
if ( url && correctedURL !== url && ! /^(?:[a-z]+:|#|\?|\.|\/)/.test( url ) ) {
|
||||
inputs.url.val( 'http://' + url );
|
||||
correctedURL = url;
|
||||
}
|
||||
}
|
||||
|
||||
inputs.url.on( 'paste', function() {
|
||||
setTimeout( correctURL, 0 );
|
||||
} );
|
||||
|
||||
inputs.url.on( 'blur', correctURL );
|
||||
},
|
||||
|
||||
open: function( editorId ) {
|
||||
@@ -157,6 +161,8 @@ var wpLink;
|
||||
if ( ! rivers.recent.ul.children().length ) {
|
||||
rivers.recent.ajax();
|
||||
}
|
||||
|
||||
correctedURL = inputs.url.val().replace( /^http:\/\//, '' );
|
||||
},
|
||||
|
||||
mceRefresh: function() {
|
||||
@@ -202,8 +208,8 @@ var wpLink;
|
||||
|
||||
getAttrs: function() {
|
||||
return {
|
||||
href: inputs.url.val(),
|
||||
title: inputs.title.val(),
|
||||
href: $.trim( inputs.url.val() ),
|
||||
title: $.trim( inputs.title.val() ),
|
||||
target: inputs.openInNewTab.prop( 'checked' ) ? '_blank' : ''
|
||||
};
|
||||
},
|
||||
|
||||
2
wp-includes/js/wplink.min.js
vendored
2
wp-includes/js/wplink.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-alpha-31605';
|
||||
$wp_version = '4.2-alpha-31606';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user