sstur / draft-js-utils

DraftJS: import/export ContentState to and from HTML/Markdown
ISC License
883 stars 234 forks source link

Convert to raw to HTML conversion #108

Open katpas opened 6 years ago

katpas commented 6 years ago

So right now I can convert the content state from the editor into html using the module below

import {stateToHTML} from 'draft-js-export-html';
let html = stateToHTML(contentState);

We're looking to take the output of convertFromRaw(contentState) which is saved into our database and then to turn this into html on the backend so we can send it as the body of an email.

Have you got any plans for rawToHTML(rawContent)?

sstur commented 6 years ago

For the time being, you will need to convert the raw (JSON-style structure) to an actual contentState (ImmutableJS-style structure) in order for stateToHTML to work.

I think it would take some serious refactoring to make this work with the raw data, so I don't have plans for that currently.

katpas commented 6 years ago

Ok thanks!