@slate-editor/image-plugin

5.1.1 • Public • Published
Nossas Cidades logo

@slate-editor/image-plugin

SlateJS image plugin.

npm package npm downloads

Installation

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

yarn add @slate-editor/image-plugin

Usage

Here is a quick example to get you started:

import React from 'react'
import { SlateEditor, SlateToolbar, SlateContent } from 'slate-editor'
import { ImagePlugin, ImageButton } from '@slate-editor/image-plugin'

const plugins = [
  ImagePlugin()
]

const SlateRichTextEditor = () => (
  <SlateEditor plugins={plugins}>
    <SlateToolbar>
      <ImageButton
        signingUrl={
          process.env.REACT_APP_API_URL +
          process.env.REACT_APP_SIGNING_URL_ENDPOINT
        }
      />
    </SlateToolbar>

    <SlateContent />
  </SlateEditor>
)

export default SlateRichTextEditor

Keyboard Shortcut

OS Shortcut
Apple Logo +shift+i
Windows Logo ctrl+shift+i

API

Name Description
ImageNode Component that holds the html that will wrap the content with image style.
ImageKeyboardShortcut Keyboard shortcut file that manipulates onKeyDown event inside SlateJS.
ImageUtils Generic file that holds the util common functions.
ImageButton Button component that have behaviour to wrap content with image style.

TODO

  • Make keyboard shortcut accepts customization

Dependencies (8)

Dev Dependencies (4)

Package Sidebar

Install

npm i @slate-editor/image-plugin

Weekly Downloads

1,124

Version

5.1.1

License

MIT

Unpacked Size

34.1 kB

Total Files

15

Last publish

Collaborators

  • alalbux
  • igrsantos
  • lpirola
  • nossas
  • rolivegab