From 7a2d51e539cfb3fe8d4fb24894528e63523cd1d1 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 25 Jun 2014 00:36:24 +0000 Subject: [PATCH] wpLink: support whole URLs including query/fragment when pre-filling the URL field. Fixes #19992 git-svn-id: https://develop.svn.wordpress.org/trunk@28828 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/wplink.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/wplink.js b/src/wp-includes/js/wplink.js index 339ce02ee6..0334be1a78 100644 --- a/src/wp-includes/js/wplink.js +++ b/src/wp-includes/js/wplink.js @@ -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( /&|�?38;/gi, '&' ) ); } else { // Set URL to default. inputs.url.val( 'http://' );