Skip to content

Commit 5d18fee

Browse files
authored
Merge pull request #9 from andrewnoyes/andrewnoyes-readme
Grab contentBlocks from output of htmlToDraft
2 parents 4ade31b + 43120eb commit 5d18fee

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ npm install html-to-draftjs --save
1414
import { EditorState, ContentState } from 'draft-js';
1515
import htmlToDraft from 'html-to-draftjs';
1616
17-
const contentBlock = htmlToDraft(html);
18-
const contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks);
17+
const blocksFromHTML = htmlToDraft(this.props.content);
18+
const contentBlocks = blocksFromHtml.contentBlocks;
19+
const contentState = ContentState.createFromBlockArray(contentBlocks);
1920
const editorState = EditorState.createWithContent(contentState);
2021
```

0 commit comments

Comments
 (0)