draft-js utils to simplify draftjs.
WARN: this repo is under development.
draft-js is awesome, and it provide some method to use.
if we want to get text in ContentBlock, we need to do something like
editorState
.getCurrentContent()
.getBlockForKey(selection.getStartKey())
.getText();
so this utils provide convienient way to use draftJS.
For example,
getContentBlockText(editorState) // do the some thing above.
All you need to do is passing editorState, which is more reasonable.
get selected entity instance (not entity key!)
@param {EditorState} editorState
@return {Entity}
return a function(editorState) and create an entity.
set contentState in provided editorState. useful when you use some method only return contentState.
return a function(editorState). apply an entity and set ContentState to provided EditorState.
return a function(editorState). apply an blockType and set ContentState to provided EditorState.
return currentBlock type.
get selected text with editorState.
convert editorState into HTML.
get plain text with editorState.
MIT