diff --git a/src/wp-admin/js/editor.js b/src/wp-admin/js/editor.js index 27a463c5dd..14a09c44ef 100644 --- a/src/wp-admin/js/editor.js +++ b/src/wp-admin/js/editor.js @@ -168,6 +168,11 @@ window.switchEditors = { content = content.replace( new RegExp('\\s*\\s*', 'g' ), '\n' ); content = content.replace( /]*)>/g, '\t' ); + if ( content.indexOf( '/g, '\n' ); + } + if ( content.indexOf( ']*)?>\s*/g, '\n\n\n\n' ); } @@ -244,6 +249,8 @@ window.switchEditors = { pee = pee.replace( new RegExp( '(<(?:' + blocklist + ')(?: [^>]*)?>)', 'gi' ), '\n$1' ); pee = pee.replace( new RegExp( '()', 'gi' ), '$1\n\n' ); pee = pee.replace( /]*)?>/gi, '\n\n' ); // hr is self closing block element + pee = pee.replace( /\s' ); pee = pee.replace( /\r\n|\r/g, '\n' ); pee = pee.replace( /\n\s*\n+/g, '\n\n' ); pee = pee.replace( /([\s\S]+?)\n\n/g, '

$1

\n' ); diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 2a01ea8db2..0f3f93ad23 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -392,6 +392,12 @@ function wpautop($pee, $br = true) { $pee = preg_replace('!()!', "$1\n\n", $pee); $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines + if ( strpos( $pee, '\s|', '', $pee ); + } + if ( strpos( $pee, '' ) !== false ) { // no P/BR around param and embed $pee = preg_replace( '|(]*>)\s*|', '$1', $pee );