prosemirror-dropimage

0.1.1 • Public • Published

(drag and) Drop Image upload for Prosemirror

File upload by dragging the images onto the Prosemirror editor. No upload form, no hassle. Accepts svg, png, jpg and gif.

Dropping image

Usage:

const {imageDropHandler} = require('prosemirror-dropimage')

...
let state = EditorState.create({
  doc: DOMParser.fromSchema(myschema).parse(document.querySelector("#content")),
  plugins: [
    ...
    imageDropHandler(myschema,'/api/fileupload'),
    ...
  ],
})

The second parameter is the upload endpoint, processes multipart/form-data file uploads and returns 200 and image URL in body.

No tests (not normal from me, I know). Pull requests and (even) issues are welcome.

Readme

Keywords

none

Package Sidebar

Install

npm i prosemirror-dropimage

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

15.4 kB

Total Files

10

Last publish

Collaborators

  • sam_ban