Make WordPress Core


Ignore:
Timestamp:
06/25/2014 12:36:24 AM (10 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/wplink.js

    r28751 r28828  
    271271            var selection = editor && editor.selection.getContent(),
    272272                emailRegexp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,
    273                 urlRegexp = /^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
     273                urlRegexp = /^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,4}[^ "]*$/i;
    274274
    275275            if ( selection && emailRegexp.test( selection ) ) {
     
    278278            } else if ( selection && urlRegexp.test( selection ) ) {
    279279                // Selection is URL
    280                 inputs.url.val( selection );
     280                inputs.url.val( selection.replace( /&|&#0?38;/gi, '&' ) );
    281281            } else {
    282282                // Set URL to default.
Note: See TracChangeset for help on using the changeset viewer.