draft-js-checkable-list-item
Checkable list item for Draft.js
npm i draft-js-checkable-list-item
Usage
Example
editor: Editor state: editorState: EditorState blockRendererFn = block: ContentBlock: ? { if block === CHECKABLE_LIST_ITEM return component: CheckableListItem props: this checked: !!block } handleTab = ev: SyntheticKeyboardEvent: ? { if this return true const editorState = thisstate const newEditorState = RichUtils if newEditorState !== editorState this } changeEditorState = editorState: EditorState: this state = editorState: EditorState { return <div> <div> <span onMouseDown=this>✔</span> </div> <Editor blockRendererFn=thisblockRendererFn blockRenderMap=DefaultDraftBlockRenderMap blockStyleFn=thisblockStyleFn editorState=thisstateeditorState onChange=thischangeEditorState onTab=thishandleTab /> </div> } : Function return { ev this } : ?string if block === CHECKABLE_LIST_ITEM return CHECKABLE_LIST_ITEM : boolean const editorState = thisstate const newEditorState = CheckableListItemUtils if newEditorState !== editorState this return true return false
Contributing
- Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request :D
License
© sugarshin