slate-paste-url-imagify

1.0.1 • Public • Published

Slate Paste URL Imagify

Greenkeeper badge version coding style: standard dependencies devDependencies Downloads Travis branch semantic-release

A Slate plugin that converts a selection in a image block element when a URL is pasted from the clipboard.

import PasteUrlImagify from 'slate-paste-url-imagify'
import { Editor } from 'slate-react'
 
// Add the plugin to your set of plugins...
const plugins = [
  PasteUrlImagify()
]
 
// And later pass it into the Slate editor...
<Editor
  ...
  plugins={plugins}
/>

This plugin works by taking in options that specify link-related commands and queries to execute when it detects that the user is trying to insert a link (by pasting or drag-dropping). This way you can define the exact behavior you want in the commands, but delegate the detection of links being inserted to the plugin.

Option Type Description
insertPastedImage (default: 'insertPastedImage') String The name of the command that insert image block. It will be passed the url of the image as its argument.
allowedImageTypes (default: ['jpg', 'jpeg', 'png', 'gif', 'svg']) Array List of allowed image extensions.

Package Sidebar

Install

npm i slate-paste-url-imagify

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

10.1 kB

Total Files

4

Last publish

Collaborators

  • nmrony