Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

TinyMCE clobbering multi-line tags with line breaks.

$
0
0

Replies: 0

There’s another topic on this already but it starts itself off on a really bad foot so I didn’t want to be associated with it. My apologies for the pseudo-duplicate post.

Preface:
I get where Automattic is going with the new editor, I just can’t use it as my purchased theme does not have support for wide and full blocks. Adding block support myself isn’t worth my time as the theme is all over the place code-wise. While I do wish there was a “just plain HTML” option for an editor, I can work around it assuming I can get TinyMCE to stop clobbering my code whenever someone else clicks the ‘Visual’ tab.

The issue:
Swapping from Text to Visual modes in the Classic Editor using the plugin causes TinyMCE to treat all lines as basic text regardless of what the code actually is. Hence, it adds <br /> and <p /> all over the place, breaking the original tag. I use a lot of <style> tags and they are all multi-line tags so they all get clobbered and then nothing will render anyway.

What I’ve tried:
Round One, plugins:

  1. Ignore Code: https://wordpress.org/plugins/ignore-code/
  2. TinyMCE Advanced: https://wordpress.org/plugins/tinymce-advanced/
  3. Don’t Muck My Markup: https://wordpress.org/plugins/dont-muck-my-markup/

Round Two, tweaks:

  1. remove_filter( ‘the_content’, ‘wpautop’ ); https://wordpress.stackexchange.com/questions/145420/disable-tinymce-autoformatting
  2. add_filter(‘tiny_mce_before_init’, ‘override_mce_options’); https://www.leighton.com/blog/stop-tinymce-in-wordpress-3-x-messing-up-your-html-code/
  3. Anything found in this thread: https://github.com/WordPress/gutenberg/issues/4672
  4. forced_root_blocks to false. https://stackoverflow.com/questions/29341221/how-to-disable-tinymce-from-auto-formatting-when-insert-content-from-source-code

Round Three, desperation:
Me, here, explaining things with a hope that someone can point me to a fix. I just don’t want TinyMCE to make adjustments to my code.

Thanks in advance,
–JC Ryan


Viewing all articles
Browse latest Browse all 59525

Trending Articles