...well, I haven't tried 3.x, but I thought I'd better mention the version I see this with in the issue title.

1. Editing pre-saved nodes (created before installing WYSIWYG) that include line breaks removes all line breaks during edit.

2. After re-entering the line breaks and then saving the node, the line breaks are removed from the node in view mode. If you go into edit mode again the line breaks are still there though.

I tried playing with the "Remove linebreaks" setting as well as the "Preformatted" and "Apply source formatting". No combination seems to work for me. Am I doing something wrong?


TwoD’s picture

Status:Active» Closed (works as designed)

1) That's because the editor re-generates the markup from the DOM tree in the editing-area. Trying to perfectly preserve whitespaces around/near nodes which may change or even be removed with every key/button press is pretty much an impossible task, so the editor makes no attempt at it. When using a WYSIWYG editor - which already inserts the correct <br /> and <p>...</p> tags rather than having the user use plain linebreaks - I strongly recommend disabling the "Convert line breaks into HTML (i.e. <br> and <p>)"-filter in the relevant Drupal text format and convert any existing content to use the proper tags. If that is not possible, there is the WYSIWYG Linebreaks module which uses a plugin to convert between the two ways of representing line breaks and paragraphs.

2) You have not set Drupal's text format to allow the <br /> and <p>...</p> tags generated by the editor instead of linebreaks/whitespaces (which - following the [X]HTML standard - are there for source formatting only and thus get collapsed to a single whitespace character on rendering anyway). You need to add those tags to the whitelist for the "Limit allowed HTML tags"-filter. For more control, I would recommend disabling that filter and using WYSIWYG Filter module's filter instead.

The "Remove linebreaks" and "Preformatted" settings have no effect for CKEditor and will be removed before the next official release. The "Apply source formatting" option inserts whitespaces/linebreaks before/after tags, which would even more confuse the "Convert line breaks into HTML (i.e. <br> and <p>)" filter and is another reason to not use it with WYSIWYG editors.

I hope that answers your questions.

TwoD’s picture

Issue summary:View changes