As the image is large, the response is slow, so must limit! How to do it? thanks!
var editor = new Quill('#postContent', {
modules: {
toolbar: '#toolbar-container'
},
theme: 'snow',
//placeholder: '不超过3000字...',
});
As the image is large, the response is slow, so must limit! How to do it? thanks!
var editor = new Quill('#postContent', {
modules: {
toolbar: '#toolbar-container'
},
theme: 'snow',
//placeholder: '不超过3000字...',
});
Sure can, I made a Quill module to compress images once they are added to the Quill editor (Pasted, Uploaded, Dragged). You can adjust the compression and quality of the compression too.
https://github.com/benwinding/quill-image-compress
import ImageCompress from 'quill-image-compress';
Quill.register('modules/imageCompress', ImageCompress);
const quill = new Quill(editor, {
// ...
modules: {
// ...
imageCompress: {
quality: 0.7, // default
maxWidth: 1000, // default
maxHeight: 1000, // default
imageType: 'image/jpeg', // default
debug: true, // default
}
}
});
Yes he can. When you add your image, use :
quill.insertEmbed(0, 'image', value, 'user'); // to insert the image
quill.formatText(0, 1, 'width', '300px'); //to limit the width
This is not possible at the moment, you would have to create a custom image handler. Feel free to open a feature request.
I gave him this solution, it is not the right one, but it works temporarily:
I modified quill.js and add this validation:
var maxSize = 2097152; // Maximum limit of 2mb (2,097,152 kb)
var fileSize = fileInput.files[0].size;
if (fileSize <= maxSize) { .... }
Image example of quill.js: