File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
# HTML To DraftJS
2
2
3
3
A library for converting to plain HTML DraftJS Editor content.
4
- Build for use with editor library react-draft-wysiwyg
4
+ Build for use with editor library ** [ react-draft-wysiwyg] ( https://github.com/jpuri/react-draft-wysiwyg ) ** .
5
5
6
- ## Installing
6
+ ## Installation
7
7
8
8
```
9
9
npm install html-to-draftjs --save
10
10
```
11
11
12
- ## Using
12
+ ## Usage
13
13
```
14
14
import { EditorState, ContentState } from 'draft-js';
15
15
import htmlToDraft from 'html-to-draftjs';
16
16
17
17
const blocksFromHtml = htmlToDraft(this.props.content);
18
- const contentBlocks = blocksFromHtml.contentBlocks;
19
- const contentState = ContentState.createFromBlockArray(contentBlocks);
18
+ const { contentBlocks, entityMap } = blocksFromHtml.contentBlocks;
19
+ const contentState = ContentState.createFromBlockArray(contentBlocks, entityMap );
20
20
const editorState = EditorState.createWithContent(contentState);
21
21
```
You can’t perform that action at this time.
0 commit comments