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

@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.11.18
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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 29 Feb 2024

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