File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,11 @@ npm install html-to-draftjs --save
11
11
12
12
## Using
13
13
```
14
+ import { EditorState, ContentState } from 'draft-js';
14
15
import htmlToDraft from 'html-to-draftjs';
15
16
16
17
const blocksFromHTML = htmlToDraft(this.props.content);
17
- const contentState = ContentState.createFromBlockArray(blocksFromHTML);
18
+ const contentBlocks = blocksFromHtml.contentBlocks;
19
+ const contentState = ContentState.createFromBlockArray(contentBlocks);
18
20
const editorState = EditorState.createWithContent(contentState);
19
21
```
Original file line number Diff line number Diff line change 8
8
},
9
9
"devDependencies" : {
10
10
"babel-preset-es2015" : " ^6.22.0" ,
11
+ "babel-preset-react" : " ^6.23.0" ,
11
12
"babel-preset-stage-0" : " ^6.22.0" ,
12
13
"chai" : " ^3.5.0" ,
13
14
"draft-js" : " ^0.10.0" ,
You can’t perform that action at this time.
0 commit comments