5.1.0 • Published 6 years ago

@slate-editor/embed-plugin v5.1.0

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

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

OSShortcut
Apple Logo+e
Windows Logo^+e

API

NameDescription
EmbedNodeComponent that holds the html that will wrap the content with embed style.
EmbedKeyboardShortcutKeyboard shortcut file that manipulates onKeyDown event inside SlateJS.
EmbedUtilsGeneric file that holds the util common functions.
EmbedButtonButton component that have behaviour to wrap content with embed style.

TODO

  • Make keyboard shortcut accepts customization