@slate-editor/list-plugin
Version:
SlateJS list node plugin.
89 lines (68 loc) • 3.26 kB
Markdown
<div align="center">
<a href="https://www.en.nossas.org" rel="noopener" target="_blank">
<img
width="200"
src="https://s3.amazonaws.com/hub-central/uploads/logo-nossas-20170517185909.svg"
alt="Nossas logo"
title="Nossas"
/>
</a>
</div>
<div align="center">
<img
src="https://www.psdmockups.com/wp-content/uploads/2016/07/slatejs-520x292.jpg"
alt="Nossas Cidades logo"
title="Nossas Cidades"
height="50"
/>
</div>
<h1 align="center">@slate-editor/list-plugin</h1>
<div align="center">
[SlateJS](https://github.com/ianstormtaylor/slate) list plugin.
[](https://www.npmjs.com/package/@slate-editor/list-plugin)
[](https://www.npmjs.com/package/@slate-editor/list-plugin)
</div>
## Installation
The **@slate-editor/list-plugin** is available as an [npm package](https://www.npmjs.com/package/@slate-editor/list-plugin).
```
yarn add @slate-editor/list-plugin
```
## Usage
Here is a quick example to get you started:
```js
import React from 'react'
import { SlateEditor, SlateToolbar, SlateContent } from 'slate-editor'
import { ListPlugin, ListButtonBar } from '@slate-editor/list-plugin'
const plugins = [
ListPlugin()
]
const SlateRichTextEditor = () => (
<SlateEditor plugins={plugins}>
<SlateToolbar>
<ListButtonBar />
</SlateToolbar>
<SlateContent />
</SlateEditor>
)
export default SlateRichTextEditor
```
## Keyboard Shortcut
| OS | Action | Shortcut |
|--------------------------|----------------|---------------------------------------------------|
| ![Apple Logo][apple] | Unordered List | <kbd>^</kbd> + <kbd>shift</kbd> + <kbd>l</kbd> |
| ![Apple Logo][apple] | Ordered List | <kbd>^</kbd> + <kbd>shift</kbd> + <kbd>n</kbd> |
| ![Windows Logo][windows] | Unordered List | <kbd>alt</kbd> + <kbd>shift</kbd> + <kbd>l</kbd> |
| ![Windows Logo][windows] | Ordered List | <kbd>alt</kbd> + <kbd>shift</kbd> + <kbd>n</kbd> |
## API
| Name | Description |
|----------------------|---------------------------------------------------------------------------|
| ListNode | Component that holds the html that will wrap the content with list style. |
| ListKeyboardShortcut | Keyboard shortcut file that manipulates `onKeyDown` event inside SlateJS. |
| ListUtils | Generic file that holds the util common functions. |
| ListButtonBar | Component that holds all action buttons to handle list behaviours. |
| UnorderedListButton | Component that render ordered list button to handle its behaviour. |
| OrderedListButton | Component that render unordered list button to handle its behaviour. |
## TODO
- Make keyboard shortcut accepts customization
[apple]: https://cdn2.iconfinder.com/data/icons/designer-skills/128/apple-ios-system-platform-os-mac-linux-48.png
[windows]: https://cdn2.iconfinder.com/data/icons/designer-skills/128/windows-48.png