html-to-draftjs icon indicating copy to clipboard operation
html-to-draftjs copied to clipboard

SSR htmlToDraft return null

Open rgnevashev opened this issue 7 years ago • 5 comments

On server side htmlToDraft returns null

rgnevashev avatar Oct 03 '17 12:10 rgnevashev

Hello @rgnevashev , try to use JSDOM on server side for this.

jpuri avatar Oct 06 '17 18:10 jpuri

I'm having the same issue, would be great to have an example server side usage case in the docs / npm / github page.

edencorbin avatar Dec 28 '17 14:12 edencorbin

Using HTML as format to save editor content is anyways avoidable. Prefer to save it as RawDraftJS content JSON format.

jpuri avatar Jan 01 '18 12:01 jpuri

Did just that, working good for me now, excellent module, thank you.

edencorbin avatar Jan 01 '18 13:01 edencorbin

@jpuri This issue sounds like the problem I'm having but in my case htmlToDraft() returns null only in the Firefox browser. I've tested in Chrome/Chromium and htmlToDraft() returns non-null. Could you at least confirm that this is indeed an issue in Firefox? And it sounds like you're suggesting that we store the entire DraftJS JSON instead of just the HTML string?

const contentBlock = htmlToDraft(HTMLString); // Returns null in Firefox.

tgus avatar Jan 31 '18 00:01 tgus