Ticket #31571: 31571.3.patch
File 31571.3.patch, 1.9 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
1220 1220 } 1221 1221 }); 1222 1222 1223 editor.on( 'beforeexeccommand', function( event ) { 1224 if ( isPlaceholder( editor.selection.getNode() ) ) { 1225 event.preventDefault(); 1226 } 1227 } ); 1228 1223 1229 return { 1224 1230 _do_shcode: parseShortcode, 1225 1231 _get_shcode: getShortcode -
src/wp-includes/js/tinymce/plugins/wplink/plugin.js
1 1 /* global tinymce */ 2 2 tinymce.PluginManager.add( 'wplink', function( editor ) { 3 3 var linkButton; 4 4 5 5 // Register a command so that it can be invoked by using tinyMCE.activeEditor.execCommand( 'WP_Link' ); 6 6 editor.addCommand( 'WP_Link', function() { 7 7 if ( ( ! linkButton || ! linkButton.disabled() ) && typeof window.wpLink !== 'undefined' ) { … … 60 60 context: 'insert', 61 61 prependToContext: true 62 62 }); 63 64 editor.on( 'pastepreprocess', function( event ) { 65 var content = event.content, 66 range; 67 68 if ( editor.selection.isCollapsed() ) { 69 return; 70 } 71 72 content = content.replace( /<[^>]+>/g, '' ); 73 content = tinymce.trim( content ); 74 75 if ( ! /^(?:https?:)?\/\/\S+$/i.test( content ) ) { 76 return; 77 } 78 79 range = editor.selection.getRng(); 80 81 function block( node ) { 82 return editor.dom.getParent( node, function( node ) { 83 return editor.dom.isBlock( node ); 84 } ); 85 } 86 87 if ( block( range.startContainer ) !== block( range.endContainer ) ) { 88 return; 89 } 90 91 editor.execCommand( 'mceInsertLink', false, { 92 href: editor.dom.decode( content ) 93 } ); 94 95 event.preventDefault(); 96 } ); 63 97 });