Make WordPress Core

Changeset 32817


Ignore:
Timestamp:
06/17/2015 05:04:23 AM (9 years ago)
Author:
iseulde
Message:

TinyMCE: wplink: don't link a URL with a pasted URL

Fixes #32357.

File:
1 edited

Legend:

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

    r32078 r32817  
    3333
    3434    editor.on( 'pastepreprocess', function( event ) {
    35         var pastedStr = event.content;
     35        var pastedStr = event.content,
     36            regExp = /^(?:https?:)?\/\/\S+$/i;
    3637
    37         if ( ! editor.selection.isCollapsed() ) {
     38        if ( ! editor.selection.isCollapsed() && ! regExp.test( editor.selection.getContent() ) ) {
    3839            pastedStr = pastedStr.replace( /<[^>]+>/g, '' );
    3940            pastedStr = tinymce.trim( pastedStr );
    4041
    41             if ( /^(?:https?:)?\/\/\S+$/i.test( pastedStr ) ) {
     42            if ( regExp.test( pastedStr ) ) {
    4243                editor.execCommand( 'mceInsertLink', false, {
    4344                    href: editor.dom.decode( pastedStr )
Note: See TracChangeset for help on using the changeset viewer.