Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

11 watching

Forks

 
 

Latest commit

 

History

49 Commits

Folders and files

Repository files navigation

HTML To DraftJS

A library for converting plain HTML to DraftJS Editor content. Build for use with react-draft-wysiwyg.

Installation

npm install html-to-draftjs --save

Usage

import { EditorState, ContentState } from 'draft-js';
import htmlToDraft from 'html-to-draftjs';

const blocksFromHtml = htmlToDraft(this.props.content);
const { contentBlocks, entityMap } = blocksFromHtml.contentBlocks;
const contentState = ContentState.createFromBlockArray(contentBlocks, entityMap);
const editorState = EditorState.createWithContent(contentState);

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

11 watching

Forks

Releases

Packages

Contributors

Languages