Socket
Socket
Sign inDemoInstall

@types/draft-js

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/draft-js

TypeScript definitions for draft-js 0.2.2


Version published
Weekly downloads
419K
decreased by-0.15%
Maintainers
1
Weekly downloads
 
Created

What is @types/draft-js?

@types/draft-js provides TypeScript definitions for the Draft.js library, which is a rich text editor framework for React. These type definitions help developers use Draft.js in TypeScript projects by providing type safety and IntelliSense support.

What are @types/draft-js's main functionalities?

EditorState

The EditorState is a core concept in Draft.js, representing the state of the editor. This includes the current content, selection, and undo/redo history.

const editorState = EditorState.createEmpty();

ContentState

ContentState represents the content of the editor. It can be created from plain text, and it is used to initialize or update the EditorState.

const contentState = ContentState.createFromText('Hello, world!');

RichUtils

RichUtils provides utility functions for common rich text operations, such as toggling inline styles (e.g., bold, italic) and block types (e.g., header, list).

const newState = RichUtils.toggleInlineStyle(editorState, 'BOLD');

Editor Component

The Editor component is the main UI component of Draft.js. It takes an EditorState and an onChange handler as props to manage the editor's state.

import { Editor } from 'draft-js';

<Editor editorState={editorState} onChange={setEditorState} />

Other packages similar to @types/draft-js

FAQs

Package last updated on 20 May 2016

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