CKEditor adds too many BR shortcuts

I am developing a web application using ASP.NET WebForms and have added CKEditor for more convenient text editing. Now the problem is that the number of spaces is too large.

Apparently, it creates a div element for each block of text (treats the empty string as another block), and then surrounds each block with an additional BR element.

There have been many times this problem has been mentioned both in SO and in official forums, although the solutions did not seem to work for me.

In the end, having spent much more time than expected, I just went for a trial and error approach and added this to my

editor.config.enterMode = CKEditor.NET.EnterMode.P; editor.config.autoParagraph = false; editor.config.shiftEnterMode = CKEditor.NET.EnterMode.P; editor.config.fillEmptyBlocks = false; editor.config.forceEnterMode = false; 

It seems to be responding to code (fillEmptyBlocks worked just fine), although it seems to completely ignore EnterMode settings.

Has anyone had the same problem and found an effective way to fix it? I literally spent a lot of time researching trial and error / Internet research, and I'm starting to feel despair (the biggest problem is not only the BR, it is the fact that the empty div also contains the BR and two BR outside it)

EDIT: It finally responds to EnterMode changes (started working after adding editor.config.forcePasteAsPlainText = true;)

Now, the interesting thing is that when EnterMode is set to BR, it allocates BR elements for each line break (including an empty line) - this means that if you have an empty line between two blocks of text, there will be a total of 4 BRs separating them. Is there any way around this?

+6
source share

All Articles