Hi there…
Cheers everyone… Happy Xmas and New Year (as I write this on December 21st)
Well… I was having this issue and it was extremely annoying as it made me think going for another editor solution. Which, btw, I was avoiding very hard because I’m building a site for a client and they have no knowledge in HTML at all.
The point is, I MUST allow the client use blank lines at his will. The option “Stop removing…..” did half the work, as it stopped WordPress from removing the blank lines, but “<p><br class=”spacer_” /></p>” was being added everytime I switched back and forth to the html editor then to the visual editor. Same problem of some of you have, I think.
What I did to solve (holpefully permanently) was to change a bit the function pre_format from tadv_replace.js file, located in <wordpress plugin folder>/tinymce-advanced/js folder.
Bellow is the changed code and the original code (commented):
c = c.replace(/<p>(\s|<br ?\/?>|\u00a0)*<\/p>/g, '<p><br class="spacer_" /></p>'); // keep empty paragraphs...
c = c.replace(/\[\/sourcecode\]\s*<br \/>\s*<br \/>/g, '[/sourcecode]');
c = c.replace(/<p( [^>]*)?>/g, '<p$1>');
c = c.replace(/<\/p>/g, '</p>');
// c = c.replace(/<\/p>\s*<p/g, '</p><p');
c = c.replace(/<\/p>\r*<p/g, '</p><br class="spacer_" /><p');
c = c.replace(/<((blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6])[^>]*)>\s*<p/g, '<$1><p');
c = c.replace(/<\/p>\s*<\/(blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6])>/g, '</p></$1>');
c = c.replace(/<br ?\/?>[\r]*/g, '<br />');
c = c.replace(/<li([^>]*)>/g, '\t<li$1>');
c = c.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '[caption$1[/caption]');
c = c.replace(new RegExp('caption\\]+\\[caption', 'g'), 'caption][caption');
// ORIGINAL
// c = c.replace(/<p>(\s|<br ?\/?>|\u00a0)*<\/p>/g, '<p><br class="spacer_" /></p>'); // keep empty paragraphs...
// c = c.replace(/\[\/sourcecode\]\s*<br \/>\s*<br \/>/g, '[/sourcecode]\n');
// c = c.replace(/<p( [^>]*)?>/g, '\n<p$1>');
// c = c.replace(/<\/p>/g, '</p>\n');
// c = c.replace(/<\/p>\s*<p/g, '</p>\n\n<p');
// c = c.replace(/<\/p>\s*<p/g, '</p><br class="spacer_" /><p');
// c = c.replace(/<((blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6])[^>]*)>\s*<p/g, '<$1><p');
// c = c.replace(/<\/p>\s*<\/(blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6])>/g, '</p></$1>');
// c = c.replace(/<br ?\/?>[\r\n]*/g, '<br />\n');
// c = c.replace(/<li([^>]*)>/g, '\t<li$1>');
// c = c.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
// c = c.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');