5.1.0 • Published 6 years ago

@slate-editor/list-plugin v5.1.0

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

SlateJS list plugin.

npm package npm downloads

Installation

The @slate-editor/list-plugin is available as an npm package.

yarn add @slate-editor/list-plugin

Usage

Here is a quick example to get you started:

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

OSActionShortcut
Apple LogoUnordered List^ + shift + l
Apple LogoOrdered List^ + shift + n
Windows LogoUnordered Listalt + shift + l
Windows LogoOrdered Listalt + shift + n

API

NameDescription
ListNodeComponent that holds the html that will wrap the content with list style.
ListKeyboardShortcutKeyboard shortcut file that manipulates onKeyDown event inside SlateJS.
ListUtilsGeneric file that holds the util common functions.
ListButtonBarComponent that holds all action buttons to handle list behaviours.
UnorderedListButtonComponent that render ordered list button to handle its behaviour.
OrderedListButtonComponent that render unordered list button to handle its behaviour.

TODO

  • Make keyboard shortcut accepts customization