5.1.0 • Published 6 years ago

@slate-editor/grid-plugin v5.1.0

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

SlateJS grid plugin.

npm package npm downloads

Installation

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

yarn add @slate-editor/grid-plugin

Usage

Here is a quick example to get you started:

import React from 'react'
import { SlateEditor, SlateToolbar, SlateContent } from 'slate-editor'
import { GridPlugin, GridButtonBar } from '@slate-editor/grid-plugin'

const plugins = [
  GridPlugin()
]

const SlateRichTextEditor = () => (
  <SlateEditor plugins={plugins}>
    <SlateToolbar>
      <GridButtonBar />
    </SlateToolbar>

    <SlateContent />
  </SlateEditor>
)

export default SlateRichTextEditor

Keyboard Shortcut

OSActionShortcut
Apple LogoAdd Grid + ^ + g
Apple LogoSplit Row + ^ + r
Windows LogoAdd Grid^ + alt + g
Windows LogoSplit Row^ + alt + r

API

NameDescription
GridNodeComponent that holds the html that will render the content with grid style.
GridRowNodeComponent that holds the html that will render the grid row.
GridCellNodeComponent that holds the html that will render the grid cell.
GridKeyboardShortcutKeyboard shortcut file that manipulates onKeyDown event inside SlateJS.
GridUtilsGeneric file that holds the util common functions.
GridButtonBarComponent that holds all action buttons to handle the grid behaviour.
GridButtonComponent that handle behaviour to wrap content with grid style.
GridSplitRowButtonComponent that handle behaviour to split rows into the grid.

TODO

  • Make keyboard shortcut accepts customization