If you turn off "apply source formatting" in the WYSIWYG profile for CKEditor, <br> tags still have source formatting applied.

This is because CKEditor itself defaults to setting breakAfterOpen : true for these elements, but the code in the WYSIWYG module doesn't have <br> as one of the tags it modifies.

Since one of the purposes of turning off "apply source formatting" is to avoid conflicts with other filters in the text format (including the line break filter), this seems like a bug because it means extra line breaks get inserted into the database when you save any content that happens to have a <br> tag in it.

The attached patch fixes it.

CommentFileSizeAuthor
ckeditor-br.patch687 bytesDavid_Rothstein
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TwoD’s picture

Thanks, will review ASAP.

pingo’s picture

I have the same problem, Running WYSIWYG 7.x-2.x-dev and Drupal 7.0-beta3.

Tried the above patch, and it didn't do the trick?

TwoD’s picture

Status: Needs review » Fixed

It worked really well for me. Just remember that the contents have to be passed through CKEditor again to actually be reformatted.

Looks like this only happens to the br tag so I'll accept the patch.
Thanks for creating the patch and reviewing, this has been committed to all branches!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Satri’s picture

Thanks for looking at this issue. I understand that it is closed now, but I still have a related problem with the latest WYSIWYG using CKEditor.

Now lines break correctly, but not paragraphs. Before this fix,
"A

B"
would have become
"AB"

With this fix, it is now
"A
B"

while it should actually be
"A

B"

What do you think? Thanks! - Alex

David_Rothstein’s picture

@Satri: It's not really clear under what conditions you're experiencing that issue (i.e. what you typed in where and with what configuration settings enabled).

In any case, it doesn't seem related to this issue at first glance. Can you create a new issue if you're having a different problem, and describe it there?

Thanks!

Satri’s picture

Thanks David for your reply. You know what.. following your comment and encouragement, I got ready to log a new issue. I thus made sure I got everything up-to-date, and to my total surprise, CKEditor 3.5.1.6398 released last Monday fixed this linebreak issue. I doubled check and yes, 3.5.0 and previous versions (at least those that I tried) failed to break paragraphs correctly. With 3.5.1, paragraphs break fine. I now consider this issue solved.

I also now use the wysiwyg_linebreaks module, which of course I disabled for testing this very issue.

Thanks-