TinyMCE: remove   from empty paragraphs inside the visual editor, props avryl, fixes #28282
git-svn-id: https://develop.svn.wordpress.org/trunk@28685 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
73e4f3e13b
commit
319299d42b
@ -355,13 +355,20 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
}
|
||||
|
||||
// Keep empty paragraphs :(
|
||||
e.content = e.content.replace( /<p>(<br ?\/?>|\u00a0|\uFEFF)?<\/p>/g, '<p> </p>' );
|
||||
e.content = e.content.replace( /<p>(?:<br ?\/?>|\u00a0|\uFEFF| )*<\/p>/g, '<p> </p>' );
|
||||
|
||||
if ( editor.getParam( 'wpautop', true ) && typeof window.switchEditors !== 'undefined' ) {
|
||||
e.content = window.switchEditors.pre_wpautop( e.content );
|
||||
}
|
||||
});
|
||||
|
||||
// Remove spaces from empty paragraphs.
|
||||
editor.on( 'BeforeSetContent', function( event ) {
|
||||
if ( event.content ) {
|
||||
event.content = event.content.replace( /<p>(?: |\u00a0|\uFEFF| )+<\/p>/gi, '<p></p>' );
|
||||
}
|
||||
});
|
||||
|
||||
editor.on( 'preInit', function() {
|
||||
// Don't replace <i> with <em> and <b> with <strong> and don't remove them when empty
|
||||
editor.schema.addValidElements( '@[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|draggable|dropzone|hidden|spellcheck|translate],i,b' );
|
||||
|
Loading…
Reference in New Issue
Block a user