From bcbe8ae224b345a1d67bd17035fb99bde9b0d870 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 10 Nov 2015 04:31:04 +0000 Subject: [PATCH] TinyMCE: always remove trailing `
` added by WebKit browsers to the clipboard. Fixes #34642. git-svn-id: https://develop.svn.wordpress.org/trunk@35597 602fd350-edb4-49c9-b593-d223f7449a82 --- .../js/tinymce/plugins/wordpress/plugin.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js index f425b234d8..d71d1cae8c 100644 --- a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -472,16 +472,19 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { } if ( editor.getParam( 'wp_paste_filters', true ) ) { - if ( ! tinymce.Env.webkit ) { - // In WebKit handled by removeWebKitStyles() - editor.on( 'PastePreProcess', function( event ) { + editor.on( 'PastePreProcess', function( event ) { + // Remove trailing
added by WebKit browsers to the clipboard + event.content = event.content.replace( /
/gi, '' ); + + // In WebKit this is handled by removeWebKitStyles() + if ( ! tinymce.Env.webkit ) { // Remove all inline styles event.content = event.content.replace( /(<[^>]+) style="[^"]*"([^>]*>)/gi, '$1$2' ); // Put back the internal styles event.content = event.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi, '$1 style=$2' ); - }); - } + } + }); editor.on( 'PastePostProcess', function( event ) { // Remove empty paragraphs