Socket
Socket
Sign inDemoInstall

@djsp/utils

Package Overview
Dependencies
23
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @djsp/utils

Utilities for draft js


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Install size
15.1 kB
Created
Weekly downloads
 

Readme

Source

@djsp/utils

Utilities for draft js

file size NPM JavaScript Style Guide

Install

npm install --save @djsp/utils

Static Methods

replaceWithAtomicBlock

replaceWithAtomicBlock(
  editorState: EditorState,
  entityType: string,
  data: Object
): EditorState

insertEntityBlock

insertEntityBlock(
  editorState: EditorState,
  entityType: string,
  data: Object
): EditorState

createEntityDecorator

createEntityDecorator(
  entityName: string,
  component: Function,
  props?: Object
): DraftDecorator

insertTextWithEntity

insertTextWithEntity(
  contentState: ContentState,
  selection: SelectionState,
  entityType: string,
  text: string,
  mutability?: 'IMMUTABLE' | 'MUTABLE' | 'SEGMENTED',
  entityData?: Object
): ContentState

createLinkAtSelection

createLinkAtSelection(
  editorState: EditorState,
  url: string
): EditorState

removeLinkAtSelection

removeLinkAtSelection(editorState: EditorState): EditorState

collapseToEnd

collapseToEnd(editorState: EditorState): EditorState

getCurrentEntityKey

getCurrentEntityKey(editorState: EditorState): ?string

createEntityStrategy

createEntityStrategy(entityType: string): (
  contentBlock: ContentBlock,
  callback: (start: number, end: number) => void,
  contentState: ContentState
) => void

getCurrentEntity

getCurrentEntity(
  editorState: EditorState
): ?DraftEntityInstance

getBlockEntityKey

getBlockEntityKey(
  contentState: ContentState,
  key: string
): ?string

hasEntity

hasEntity(
  editorState: EditorState,
  entityType: string
): boolean

insertNewLine

insertNewLine(editorState: EditorState): EditorState

License

MIT © juliankrispel

FAQs

Last updated on 05 Nov 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc