Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-to-draftjs

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-to-draftjs

A library for converting plain HTML to DraftJS Editor content. Build for use with **[react-draft-wysiwyg](https://github.com/jpuri/react-draft-wysiwyg)**.

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
267K
decreased by-1.61%
Maintainers
1
Weekly downloads
 
Created

What is html-to-draftjs?

The html-to-draftjs npm package is a utility that converts HTML markup into Draft.js ContentState, which is a data structure used by the Draft.js editor framework. This allows developers to easily integrate HTML content into Draft.js editors.

What are html-to-draftjs's main functionalities?

Convert HTML to Draft.js ContentState

This feature allows you to convert HTML strings into Draft.js ContentState, which can then be used to initialize or update the state of a Draft.js editor.

const htmlToDraft = require('html-to-draftjs').default;
const { ContentState, EditorState } = require('draft-js');

const html = '<p>Hello, world!</p>';
const contentBlock = htmlToDraft(html);
const contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks);
const editorState = EditorState.createWithContent(contentState);
console.log(editorState);

Other packages similar to html-to-draftjs

FAQs

Package last updated on 08 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc