A module for Quill editor to allow paste image.
<script src="./quill-image-paste-module/image-paste.min.js"></script>
var quill = new Quill(editor, {
// ...
modules: {
// ...
imagePaste: {
// options
}
}
});
Pass an empty object, paste image as base64
var quill = new Quill(editor, {
// ...
modules: {
// ...
imagePaste: {}
}
});
You can also use addImageBlob
option to upload image to server
const quill = new Quill(editor, {
// ...
modules: {
// ...
imagePaste: {
addImageBlob: function (blob, callback) {
var formData = new FormData()
formData.append('image', blob)
// your upload function, get the uploaded image url, add then
callback(imageUrl)
}
}
}
});