Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

convertFromHTML doesn't preserve <br>s inside <div>s #578

Closed
gdehmlow opened this issue Aug 1, 2016 · 5 comments
Closed

convertFromHTML doesn't preserve <br>s inside <div>s #578

gdehmlow opened this issue Aug 1, 2016 · 5 comments

Comments

@gdehmlow
Copy link

gdehmlow commented Aug 1, 2016

Let's say I have some text in the editor:

hello

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:

hello
we're separated by a line
and us by two
@benbriggs
Copy link
Contributor

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.

@facilitator999
Copy link

facilitator999 commented Feb 1, 2018

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.

@asif-alam
Copy link

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

@scottfr
Copy link

scottfr commented Oct 10, 2019

I think this is not good default behavior and should be changed. The current behavior also does the align with most other RTE's.

@Smaxor5
Copy link

Smaxor5 commented May 19, 2020

This is awful default behavior.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants