TinyMCE: fix freezing the editor when wpautop is disabled and a paragraph starts with a lot of white space characters.
Fixes #38294. git-svn-id: https://develop.svn.wordpress.org/trunk@39204 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
74e3e309c3
commit
9f67a915d9
@ -131,10 +131,9 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||
}
|
||||
|
||||
// Remove spaces from empty paragraphs.
|
||||
// Avoid backtracking, can freeze the editor. See #35890.
|
||||
// (This is also quite faster than using only one regex.)
|
||||
// Try to avoid a lot of backtracking, can freeze the editor. See #35890 and #38294.
|
||||
event.content = event.content.replace( /<p>([^<>]+)<\/p>/gi, function( tag, text ) {
|
||||
if ( /^( |\s|\u00a0|\ufeff)+$/i.test( text ) ) {
|
||||
if ( text === ' ' || ! /\S/.test( text ) ) {
|
||||
return '<p><br /></p>';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user