@kalem-editor/plugin-image-upload
v1.0.0
Published
Kalem plugin: image upload by drag and drop or paste, with your own upload hook
Maintainers
Readme
@kalem-editor/plugin-image-upload
Kalem plugin: image upload by drag and drop or paste, with your own upload hook.
Part of Kalem — a WYSIWYG editor for people who don't know Markdown, that saves Markdown.
npm i @kalem-editor/plugin-image-uploadimport { imageUploadPlugin } from '@kalem-editor/plugin-image-upload';
import '@kalem-editor/themes/plugin-image.css';
editor.addPlugin(
imageUploadPlugin({
upload: async ({ file, onProgress, signal }) => {
const response = await fetch('/api/upload', { method: 'POST', body: file, signal });
onProgress(1);
return (await response.json()).url;
},
}),
);Drag and drop, paste and file picker, with progress and cancellation. The plugin knows nothing about the network — upload is yours.
Documentation, guides and the full API: see the Kalem repository.
License
MIT
