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

Fixes #32357.



git-svn-id: https://develop.svn.wordpress.org/trunk@32817 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ella Iseulde Van Dorpe
2015-06-17 05:04:23 +00:00
parent 33e63b7bda
commit f81208f55a

View File

@@ -32,13 +32,14 @@ tinymce.PluginManager.add( 'wplink', function( editor ) {
});
editor.on( 'pastepreprocess', function( event ) {
var pastedStr = event.content;
var pastedStr = event.content,
regExp = /^(?:https?:)?\/\/\S+$/i;
if ( ! editor.selection.isCollapsed() ) {
if ( ! editor.selection.isCollapsed() && ! regExp.test( editor.selection.getContent() ) ) {
pastedStr = pastedStr.replace( /<[^>]+>/g, '' );
pastedStr = tinymce.trim( pastedStr );
if ( /^(?:https?:)?\/\/\S+$/i.test( pastedStr ) ) {
if ( regExp.test( pastedStr ) ) {
editor.execCommand( 'mceInsertLink', false, {
href: editor.dom.decode( pastedStr )
} );