You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble figuring out how to load a soft newline. When I type in the editor:
Hi
there
It spits out the html <p>Hi<br/>\nthere</p>. In my case, I'm exporting this html and saving it in a database. When they come back to the editor, I call createValueFromString to repopulate the text but the newline is gone... we get <p>Hi<br/> there</p>, instead. The newline is now a space.
I tracked this down to the collapseWhitespace function in draft-js-import-element. I assume there's a good reason to strip out the whitespace so I'm not sure the best way to go about fixing this is.
You can easily repro the issue by appending this block to EditorDemo.js:
<divclassName="row"><RichTextEditorvalue={RichTextEditor.createValueFromString(value.toString(format),format)}placeholder="Tell a story"
/>
</div>
Then fire up the demo page, and type some text with a soft newline (Shift-Enter) in the top editor.
The text was updated successfully, but these errors were encountered:
I'm having trouble figuring out how to load a soft newline. When I type in the editor:
It spits out the html
<p>Hi<br/>\nthere</p>
. In my case, I'm exporting this html and saving it in a database. When they come back to the editor, I callcreateValueFromString
to repopulate the text but the newline is gone... we get<p>Hi<br/> there</p>
, instead. The newline is now a space.I tracked this down to the
collapseWhitespace
function indraft-js-import-element
. I assume there's a good reason to strip out the whitespace so I'm not sure the best way to go about fixing this is.You can easily repro the issue by appending this block to
EditorDemo.js
:Then fire up the demo page, and type some text with a soft newline (Shift-Enter) in the top editor.
The text was updated successfully, but these errors were encountered: