TinyMCE: pad empty paragraphs with `<br>` in Chrome to stop it from inserting non-breaking spaces in them.

Props iseulde. Fixes #31255.

git-svn-id: https://develop.svn.wordpress.org/trunk@31878 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-03-25 01:17:04 +00:00
parent 12070176d9
commit f6e1aeee60
1 changed files with 3 additions and 1 deletions

View File

@ -394,8 +394,10 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
// Remove spaces from empty paragraphs. // Remove spaces from empty paragraphs.
editor.on( 'BeforeSetContent', function( event ) { editor.on( 'BeforeSetContent', function( event ) {
var paragraph = tinymce.Env.webkit ? '<p><br /></p>' : '<p></p>';
if ( event.content ) { if ( event.content ) {
event.content = event.content.replace( /<p>(?:&nbsp;|\u00a0|\uFEFF| )+<\/p>/gi, '<p></p>' ); event.content = event.content.replace( /<p>(?:&nbsp;|\u00a0|\uFEFF|\s)+<\/p>/gi, paragraph );
} }
}); });