Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

Latest commit

 

History

History

slate-editor-grid-plugin

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
Nossas Cidades logo

@slate-editor/grid-plugin

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

OS Action Shortcut
Apple Logo Add Grid + ^ + g
Apple Logo Split Row + ^ + r
Windows Logo Add Grid ^ + alt + g
Windows Logo Split Row ^ + alt + r

API

Name Description
GridNode Component that holds the html that will render the content with grid style.
GridRowNode Component that holds the html that will render the grid row.
GridCellNode Component that holds the html that will render the grid cell.
GridKeyboardShortcut Keyboard shortcut file that manipulates onKeyDown event inside SlateJS.
GridUtils Generic file that holds the util common functions.
GridButtonBar Component that holds all action buttons to handle the grid behaviour.
GridButton Component that handle behaviour to wrap content with grid style.
GridSplitRowButton Component that handle behaviour to split rows into the grid.

TODO

  • Make keyboard shortcut accepts customization