philipp
philipp

Reputation: 16495

Draft.js—get editor content as html

I am starting with Draft.js right now, so I might miss some important things here. But as the title says: I would like to get the full html generated by the editor. Right now I have:

this.state.editor.getCurrentContent() // Object ContentState
this.state.editor.getCurrentContent().getPlainText() // no html tags

Upvotes: 3

Views: 1413

Answers (1)

Jiang YD
Jiang YD

Reputation: 3311

First of say, draftjs is not designed for HTML editing, although it use HTML to rendering the editor. For now there is no any perfect solution to export the ContentState to HTML.

The draft-js-export-html may help a lot if you not do much customization to draftjs blocks.

Upvotes: 2

Related Questions