Quill ImageUpload Module
A module for Quill rich text editor to upload images to be selected from toolbar editor.
Usage
Webpack/ES6
import Quill from 'quill';
import { ImageUpload } from 'quill-image-upload';
Quill.register('modules/imageUpload', ImageUpload);
const quill = new Quill(editor, {
modules: {
imageUpload: {
url: '',
method: 'POST',
name: 'image',
withCredentials: false,
headers: {},
csrf: { token: 'token', hash: '' },
customUploader: () => {},
callbackOK: (serverResponse, next) => {
next(serverResponse);
},
callbackKO: serverError => {
alert(serverError);
},
checkBeforeSend: (file, next) => {
console.log(file);
next(file);
}
}
}
});
Script Tag
Copy image-upload.min.js into your web root or include from node_modules
<script src="/node_modules/quill-image-upload/image-upload.min.js"></script>
var quill = new Quill(editor, {
modules: {
imageUpload: {
url: '',
method: 'POST',
name: 'image',
withCredentials: false,
headers: {},
callbackOK: (serverResponse, next) => {
next(serverResponse);
},
callbackKO: serverError => {
alert(serverError);
}
}
}
});