Ticket #20943: 20943_patch.diff
File 20943_patch.diff, 2.1 KB (added by , 10 years ago) |
---|
-
wp-admin/js/editor.js
142 142 }); 143 143 } 144 144 145 //Blocks for which to retain the p tag 146 skipBlocklist = 'ul|ol|li|table|thead|tbody|tfoot|tr|th|td'; 147 preserve_p = new RegExp( '\\s*</(' + skipBlocklist + ')>\\s*', 'g' ).test(content); 148 145 149 // Pretty it up for the source editor 146 150 blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset'; 147 151 content = content.replace( new RegExp( '\\s*</(' + blocklist1 + ')>\\s*', 'g' ), '</$1>\n' ); … … 153 157 // Separate <div> containing <p> 154 158 content = content.replace( /<div( [^>]*)?>\s*<p>/gi, '<div$1>\n\n' ); 155 159 156 // Remove <p> and <br /> 157 content = content.replace( /\s*<p>/gi, '' ); 158 content = content.replace( /\s*<\/p>\s*/gi, '\n\n' ); 159 content = content.replace( /\n[\s\u00a0]+\n/g, '\n\n' ); 160 content = content.replace( /\s*<br ?\/?>\s*/gi, '\n' ); 160 // Remove <p> and <br />. Also check the block list to be skipped. 161 if ( false === preserve_p ) { 162 content = content.replace( /\s*<p>/gi, '' ); 163 content = content.replace( /\s*<\/p>\s*/gi, '\n\n' ); 164 content = content.replace( /\n[\s\u00a0]+\n/g, '\n\n' ); 165 content = content.replace( /\s*<br ?\/?>\s*/gi, '\n' ); 166 } 161 167 162 168 // Fix some block element newline issues 163 169 content = content.replace( /\s*<div/g, '\n<div' ); -
wp-includes/js/tinymce/plugins/wordpress/plugin.js
379 379 380 380 editor.on( 'SaveContent', function( e ) { 381 381 // If editor is hidden, we just want the textarea's value to be saved 382 if ( ! editor.inline && editor.isHidden()) {382 if ( ( ! editor.inline && editor.isHidden() ) || editor.isNotDirty ) { 383 383 e.content = e.element.value; 384 384 return; 385 385 }