0.1.5 • Published 7 years ago

@djsp/utils v0.1.5

Weekly downloads
2
License
MIT
Repository
-
Last release
7 years ago

@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

0.1.5

7 years ago

0.1.4

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.5

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago