Changeset 39902
- Timestamp:
- 01/15/2017 02:05:44 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
r39284 r39902 130 130 } ); 131 131 } 132 133 // Remove spaces from empty paragraphs. 134 // Try to avoid a lot of backtracking, can freeze the editor. See #35890 and #38294. 135 event.content = event.content.replace( /<p>([^<>]+)<\/p>/gi, function( tag, text ) { 136 if ( text === ' ' || ! /\S/.test( text ) ) { 137 return '<p><br /></p>'; 138 } 139 140 return tag; 141 }); 142 } 132 } 133 }); 134 135 editor.on( 'setcontent', function() { 136 // Remove spaces from empty paragraphs. 137 editor.$( 'p' ).each( function( i, node ) { 138 if ( node.innerHTML && node.innerHTML.length < 10 ) { 139 var html = tinymce.trim( node.innerHTML ); 140 141 if ( ! html || html === ' ' ) { 142 node.innerHTML = ( tinymce.Env.ie && tinymce.Env.ie < 11 ) ? '' : '<br data-mce-bogus="1">'; 143 } 144 } 145 } ); 143 146 }); 144 147
Note: See TracChangeset
for help on using the changeset viewer.