TinyMCE: fix freezing the editor when wpautop is disabled and a paragraph starts with a lot of white space characters.
Fixes #38294. Built from https://develop.svn.wordpress.org/trunk@39204 git-svn-id: http://core.svn.wordpress.org/trunk@39144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
788761c601
commit
5e8f67540e
|
@ -131,10 +131,9 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove spaces from empty paragraphs.
|
// Remove spaces from empty paragraphs.
|
||||||
// Avoid backtracking, can freeze the editor. See #35890.
|
// Try to avoid a lot of backtracking, can freeze the editor. See #35890 and #38294.
|
||||||
// (This is also quite faster than using only one regex.)
|
|
||||||
event.content = event.content.replace( /<p>([^<>]+)<\/p>/gi, function( tag, text ) {
|
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>';
|
return '<p><br /></p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-beta3-39203';
|
$wp_version = '4.7-beta3-39204';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue