draft-js-checkable-list-plugin
Version:
Checkable list plugin for DraftJS
64 lines (47 loc) • 1.99 kB
Markdown
[![CircleCI][circleci-image]][circleci-url]
[![Coverage Status][coveralls-image]][coveralls-url]
[![npm version][npm-image]][npm-url]
[![License][license-image]][license-url]
Checkable list item plugin for the [draft-js-plugins-editor](https://github.com/draft-js-plugins/draft-js-plugins) .
```sh
yarn add draft-js-checkable-list-plugin
```
[](https://sugarshin.github.io/draft-js-checkable-list-plugin/)
Example
```js
import React, { Component } from 'react'
import { EditorState } from 'draft-js'
import Editor from 'draft-js-plugins-editor'
import createCheckableListPlugin from 'draft-js-checkable-list-plugin'
import 'draft-js-checkable-list-plugin/lib/plugin.css'
const checkableListPlugin = createCheckableListPlugin()
const plugins = [checkableListPlugin]
class App extends Component {
state = { editorState: EditorState.createEmpty() }
onChange = editorState => this.setState({ editorState })
render() {
return (
<div>
<Editor
editorState={this.state.editorState}
plugins={plugins}
onChange={this.onChange}
/>
</div>
)
}
}
```
[][license-url]
© sugarshin
[]: https://circleci.com/gh/sugarshin/draft-js-checkable-list-plugin/tree/master.svg?style=svg&circle-token=d416d2a32786c1e139bac37cf6864b310b1da172
[]: https://circleci.com/gh/sugarshin/draft-js-checkable-list-plugin/tree/master
[]: https://coveralls.io/repos/github/sugarshin/draft-js-checkable-list-plugin/badge.svg?branch=master
[]: https://coveralls.io/github/sugarshin/draft-js-checkable-list-plugin?branch=master
[]: https://img.shields.io/npm/v/draft-js-checkable-list-plugin.svg?style=flat-square
[]: https://www.npmjs.org/package/draft-js-checkable-list-plugin
[]: https://img.shields.io/:license-mit-blue.svg?style=flat-square
[]: https://sugarshin.mit-license.org/