Bug #4918

some newlines ignored in PRE elements

2011-12-26 15:51:00 By: mrclay
firefox msie safari chrome opera
Open Priority: 3 Resolution: None Assigned to: None
In PRE elements, newlines that appear inside inline elements (CODE/STRONG/etc.) are converted to spaces in the editor. The loss occurs when the content is being pulled from the TEXTAREA.

The Fiddle has a pretty clear demonstration.

I started to see this behavior some months ago after a WordPress upgrade. It's possible that WP was formerly converting all newlines to BRs before passing the content to TinyMCE, but it seems like a TinyMCE bug nonetheless.


If you wish to follow or post a comment, you need to be registered and logged in.


User Image
  • 2011-12-26 22:20:06


Fixing tinyMCE is beyond me, but I did find a workaround: add a onBeforeSetContent handler that converts newlines to BR inside PREs.

Workaround in action: http://fiddle.tinymce.com/89aaab

User Image
  • 2011-12-26 22:21:18


Sorry, the workaround is at: http://fiddle.tinymce.com/cAaaab