1.0.1 • Published 5 years ago

slate-paste-url-imagify v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

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.

OptionTypeDescription
insertPastedImage (default: 'insertPastedImage')StringThe 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'])ArrayList of allowed image extensions.