0.5.3 • Published 6 years ago

draft-js-toolbox v0.5.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

DraftJs Toolbox

Useful goodies for DraftJS.

Usage

This library contains two sets of functions: 1. Utilities: that determine certain conditions on the editor's state. 2. Modifiers: which perform transformations on the editor's state.

Utils

FunctionParamsDescription
getCurrentBlockeditorStateReturns the current block selected.
isCurrentBlockTypeeditorState, blockTypeChecks the current block's type.
isBlockWithEntityTypeeditorState, block, entityTypeChecks if the current block is an atomic block with an specific entity type.

Modifiers

FunctionParamsDescription
addBlockeditorState, entityType, dataChanges the current block's type and replace its data.
addAtomicBlockeditorState, entityType, dataInserts an atomic block and creates an Entity with custom data.
removeBlockeditorState, blockKeyRemoves a block given its key.