A library for converting plain HTML to DraftJS Editor content. Build for use with react-draft-wysiwyg.
npm install html-to-draftjs --save
import { EditorState, ContentState } from 'draft-js';
import htmlToDraft from 'html-to-draftjs';
const blocksFromHtml = htmlToDraft(this.props.content);
const { contentBlocks, entityMap } = blocksFromHtml;
const contentState = ContentState.createFromBlockArray(contentBlocks, entityMap);
const editorState = EditorState.createWithContent(contentState);