wpLink: support whole URLs including query/fragment when pre-filling the URL field. Fixes #19992

Built from https://develop.svn.wordpress.org/trunk@28828


git-svn-id: http://core.svn.wordpress.org/trunk@28632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-06-25 00:37:15 +00:00
parent c6ef7d05e0
commit c8ce9e2815
3 changed files with 4 additions and 4 deletions

View File

@ -270,14 +270,14 @@ var wpLink;
setDefaultValues: function() {
var selection = editor && editor.selection.getContent(),
emailRegexp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,
urlRegexp = /^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
urlRegexp = /^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,4}[^ "]*$/i;
if ( selection && emailRegexp.test( selection ) ) {
// Selection is email address
inputs.url.val( 'mailto:' + selection );
} else if ( selection && urlRegexp.test( selection ) ) {
// Selection is URL
inputs.url.val( selection );
inputs.url.val( selection.replace( /&|&#0?38;/gi, '&' ) );
} else {
// Set URL to default.
inputs.url.val( 'http://' );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.0-alpha-20140624';
$wp_version = '4.0-alpha-20140625';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.