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-embed-plugin

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
Nossas Cidades logo

@slate-editor/embed-plugin

SlateJS embed plugin.

npm package npm downloads

Installation

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

yarn add @slate-editor/embed-plugin

Usage

Here is a quick example to get you started:

import React from 'react'
import { SlateEditor, SlateToolbar, SlateContent } from 'slate-editor'
import { EmbedPlugin, EmbedButton } from '@slate-editor/embed-plugin'

const plugins = [
  EmbedPlugin()
]

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

    <SlateContent />
  </SlateEditor>
)

export default SlateRichTextEditor

Keyboard Shortcut

OS Shortcut
Apple Logo +e
Windows Logo ^+e

API

Name Description
EmbedNode Component that holds the html that will wrap the content with embed style.
EmbedKeyboardShortcut Keyboard shortcut file that manipulates onKeyDown event inside SlateJS.
EmbedUtils Generic file that holds the util common functions.
EmbedButton Button component that have behaviour to wrap content with embed style.

TODO

  • Make keyboard shortcut accepts customization