draft-js-utils icon indicating copy to clipboard operation
draft-js-utils copied to clipboard

Why to keep "\n" in html string ?

Open Flip437 opened this issue 3 years ago • 1 comments

https://github.com/sstur/draft-js-utils/blob/85b9d7e4181202adb99a22ea410922694c3347f8/packages/draft-js-export-html/src/stateToHTML.js#L499

Why do you keep "\n" char in html string after
. This can create issues when using the string containing "\n" with a FormData e.g. (https://stackoverflow.com/questions/69835705/formdata-textarea-puts-r-carriage-return-when-sent-with-post)

Flip437 avatar Sep 14 '22 03:09 Flip437

+1! I had an issue with this recently... Draft editor had only 1 blank line between texts. After export, this one line looked like this ...</p>\n<p><br></p>\n<p>.... So many new lines... I had html to text converter which converted this to 5 blank lines 🤣, instead of one... I think <p> tags were also treated as new lines as in css.

itekhi avatar May 18 '23 14:05 itekhi