mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-03 08:40:10 +00:00
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:
@@ -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 )
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user