-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Bug in convertFromHTML (empty lines are missing) #1082
Comments
I ran into this (or very similar) issue this week also. Though, I could replicate the same problem in v0.9.1 so I figured it was intentional somehow. I've setup a similar test with a range of HTML block elements that I'd expect to get converted to ContentBlocks. Sadly only blocks with text get converted. Here is my Stack Overflow question on it. |
Same here (missing empty lines) when converting from previously saved as html content to draft-js content. DraftJS 0.10 + Webpack 2.0 |
I resolved many problems by using https://github.com/sstur/draft-js-import-html instead |
It looks like draft-js-import-html might get the job done. I might have to manipulate my HTML a bit but at least it supports empty blocks. Also, I'll have to ignore some console warnings until they implement DraftJs 0.10 support but it could be worse. |
Works here too on first try. Thank you @NoZiL |
Update: turns out that draft-js-import-html doesn't import inline styles from html
|
i get this error : : 'convertFromHTML' is not defined no-undef convertFromHTML |
This one worked for my issues https://github.com/jpuri/html-to-draftjs Was able to read multiple new lines and text-align perfectly |
If anyone is still looking, I also ended up using
|
convertFromHTML works wrong. Let's see examples.
https://jsfiddle.net/m6z0xn4r/176/
There we see 3 different blocks instead of 4. And each block has 1 test row and 1 blank row
https://jsfiddle.net/m6z0xn4r/177/
There we see good pasting text, but third line (empty) is missed.
Actualy, I expect:
The first line //data-offset-key="b7tn6-0-0"
The second line //data-offset-key="2oula-0-0"
empty line //data-offset-key="avbam-0-0"
The fourth line //data-offset-key="3l8as-0-0"
in v0.9 it worked fine
I use DraftJS 0.10 + Webpack 2.0
The text was updated successfully, but these errors were encountered: