Editor: When stripping paragraph tags, and there is a <br> at the beginning or the end, merge them and keep the paragraph, not the <br>.

Props rellect.
Fixes #37066.
Built from https://develop.svn.wordpress.org/trunk@40787


git-svn-id: http://core.svn.wordpress.org/trunk@40645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2017-05-18 22:55:42 +00:00
parent b398ccf2a1
commit d7c37de2de
3 changed files with 10 additions and 4 deletions

View File

@ -224,8 +224,14 @@ window.wp = window.wp || {};
// Normalize white space chars and remove multiple line breaks.
html = html.replace( /\n[\s\u00a0]+\n/g, '\n\n' );
// Rrplace <br> tags with a line break.
html = html.replace( /\s*<br ?\/?>\s*/gi, '\n' );
// Replace <br> tags with line breaks.
html = html.replace( /(\s*)<br ?\/?>\s*/gi, function( match, space ) {
if ( space && space.indexOf( '\n' ) !== -1 ) {
return '\n\n';
}
return '\n';
});
// Fix line breaks around <div>.
html = html.replace( /\s*<div/g, '\n<div' );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-beta1-40786';
$wp_version = '4.8-beta1-40787';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.