Let's say I have some text in the editor:
we're separated by a line
and us by two
In the editor, when creating this text, I end up with 6 blocks, with the 2nd, 4th, and 5th having empty text.
The HTML I generate from this text looks like this (which is very similar to the HTML outputted during editing):
<div>hello</div>
<div><br></div>
<div>we're separated by a line</div>
<div><br></div>
<div><br></div>
<div>and us by two</div>
If I use convertFromHTML() on this HTML, I would expect to get 6 content blocks back. Instead, I only get 3, and all of the empty lines get collapsed. So after I load the 3 blocks, the text in the editor ends up like this:
we're separated by a line
and us by two
This was discussed a bit in https://github.com/facebook/draft-js/issues/231:
This was on purpose to keep pastes of long text from having a lot of extra spaces between paragraphs. The content coming in can be pretty messy sometimes and this is one of the things we try to do to clean it up.
I have the exact issue; what trick did you use to fix it without using another module?
The sql entry is fine and were able to print fine. Its just when i come back to the editor the paragraphs are crammed and we cannot tell if a paragraph was put in.
This was discussed a bit in #231:
This was on purpose to keep pastes of long text from having a lot of extra spaces between paragraphs. The content coming in can be pretty messy sometimes and this is one of the things we try to do to clean it up.
To do the cleanup removing the users input which is not right
I think this is not good default behavior and should be changed. The current behavior also does the align with most other RTE's.
This is awful default behavior.
Most helpful comment
I think this is not good default behavior and should be changed. The current behavior also does the align with most other RTE's.