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:
parent
12070176d9
commit
f6e1aeee60
|
@ -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>(?: |\u00a0|\uFEFF| )+<\/p>/gi, '<p></p>' );
|
event.content = event.content.replace( /<p>(?: |\u00a0|\uFEFF|\s)+<\/p>/gi, paragraph );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue