Slate Paste URL Imagify
A Slate plugin that converts a selection in a image block element when a URL is pasted from the clipboard.
// Add the plugin to your set of plugins...const plugins = // 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. |