TinyMCE: remove   from empty paragraphs inside the visual editor, props avryl, fixes #28282
Built from https://develop.svn.wordpress.org/trunk@28685 git-svn-id: http://core.svn.wordpress.org/trunk@28503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
60e323d911
commit
a59cf45c4d
|
@ -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' );
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in New Issue