Skip to content

Latest commit

 

History

History
124 lines (96 loc) · 1.78 KB

APIReference-RichUtils.md

File metadata and controls

124 lines (96 loc) · 1.78 KB
id title layout category next permalink
api-reference-rich-utils
RichUtils
docs
API Reference
api-reference-atomic-block-utils
docs/api-reference-rich-utils.html

The RichUtils module is a static set of utility functions for rich text editing.

In each case, these methods accept EditorState objects with relevant parameters and return EditorState objects.

Static Methods

currentBlockContainsLink

currentBlockContainsLink(
  editorState: EditorState
): boolean

getCurrentBlockType

getCurrentBlockType(
  editorState: EditorState
): string

handleKeyCommand

handleKeyCommand(
  editorState: EditorState,
  command: string
): ?EditorState

insertSoftNewline

insertSoftNewline(
  editorState: EditorState
): EditorState

onBackspace

onBackspace(
  editorState: EditorState
): EditorState?

onDelete

onDelete(
  editorState: EditorState
): EditorState?

onTab

onTab(
  event: SyntheticEvent,
  editorState: EditorState,
  maxDepth: integer
): EditorState

toggleBlockType

toggleBlockType(
  editorState: EditorState,
  blockType: string
): EditorState

toggleCode

toggleCode(
  editorState: EditorState
): EditorState

toggleInlineStyle

toggleInlineStyle(
  editorState: EditorState,
  inlineStyle: string
): EditorState

Toggle the specified inline style for the selection. If the user's selection is collapsed, apply or remove the style for the internal state. If it is not collapsed, apply the change directly to the document state.

toggleLink

toggleLink(
  editorState: EditorState,
  targetSelection: SelectionState,
  entityKey: string
): EditorState

tryToRemoveBlockStyle

tryToRemoveBlockStyle(
  editorState: EditorState
): ContentState?