TinyMCE: always remove trailing <br> added by WebKit browsers to the clipboard.

Fixes #34642.

git-svn-id: https://develop.svn.wordpress.org/trunk@35597 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-11-10 04:31:04 +00:00
parent 845aa2d01e
commit bcbe8ae224

View File

@ -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 <br> added by WebKit browsers to the clipboard
event.content = event.content.replace( /<br class="?Apple-interchange-newline"?>/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