Fill empty TinyMCE paragraphs with a dummy <br /> on all browsers.

fixes #33151
props iseulde

git-svn-id: https://develop.svn.wordpress.org/trunk@33461 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2015-07-28 14:11:04 +00:00
parent 972f871214
commit cda0fa1f76

View File

@ -92,8 +92,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
// Replace Read More/Next Page tags with images // Replace Read More/Next Page tags with images
editor.on( 'BeforeSetContent', function( event ) { editor.on( 'BeforeSetContent', function( event ) {
var title, var title;
paragraph = tinymce.Env.webkit ? '<p><br /></p>' : '<p></p>';
if ( event.content ) { if ( event.content ) {
if ( event.content.indexOf( '<!--more' ) !== -1 ) { if ( event.content.indexOf( '<!--more' ) !== -1 ) {
@ -113,12 +112,12 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
'title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' ); 'title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' );
} }
// Remove spaces from empty paragraphs.
event.content = event.content.replace( /<p>(?:&nbsp;|\u00a0|\uFEFF|\s)+<\/p>/gi, paragraph );
if ( event.load && event.format !== 'raw' && hasWpautop ) { if ( event.load && event.format !== 'raw' && hasWpautop ) {
event.content = wp.editor.autop( event.content ); event.content = wp.editor.autop( event.content );
} }
// Remove spaces from empty paragraphs.
event.content = event.content.replace( /<p>(?:&nbsp;|\u00a0|\uFEFF|\s)+<\/p>/gi, '<p><br /></p>' );
} }
}); });