Gathering detailed insights and metrics for quill-image-drop-and-paste
Gathering detailed insights and metrics for quill-image-drop-and-paste
Gathering detailed insights and metrics for quill-image-drop-and-paste
Gathering detailed insights and metrics for quill-image-drop-and-paste
quill-image-drop-module
A module for Quill rich text editor to allow images to be pasted and drag/dropped into the editor.
quill2-image-drop-and-paste
A quill plugin to deal with pasting and droping images and html including images
quill-image
A quill editor module for drop and paste image, with a callback hook before insert image into the editor
@portive/quill-images
Add image uploads with click to upload, drag and drop and paste support. Includes upload progress bar, quick image preview, server side image resizing, presets, support for higher DPI devices with srcset. Completely configurable styling.
A quill editor module for drop and paste image, with a callback hook before insert image into the editor
npm install quill-image-drop-and-paste
Typescript
Module System
Node Version
NPM Version
97
Supply Chain
99.6
Quality
77.9
Maintenance
100
Vulnerability
100
License
Compectable with quill@^2.0.2
Updated on Aug 07, 2024
feat: add autoConvert option
Updated on Apr 18, 2023
Release v1.2.14
Updated on Oct 27, 2022
Release v1.2.12
Updated on Oct 21, 2022
bugfix: converting arraybuffer to string cause error
Updated on May 10, 2022
fix the paste event prevent the clipboard matchers
Updated on Feb 22, 2022
TypeScript (40.82%)
CSS (27.91%)
JavaScript (11.37%)
HTML (10.88%)
Vue (6.98%)
Shell (1.86%)
SCSS (0.17%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
ISC License
118 Stars
89 Commits
42 Forks
3 Watchers
2 Branches
9 Contributors
Updated on Jun 13, 2025
Latest Version
2.0.1
Package Id
quill-image-drop-and-paste@2.0.1
Unpacked Size
154.26 kB
Size
18.31 kB
File Count
13
NPM Version
6.14.18
Node Version
14.21.3
Published on
Aug 07, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
24
A quill editor module for drop and paste image, with a callback hook before inserting image into the editor.
This module supported drop and paste image into the quill editor, by default, it would insert a image with a base64 url. Because of a base64 string was too large, if we saved it into the database, it could easilly out of the size of the column, the best practice was to save the image on our server and returned the image's url, and finally we inserted the image with the returned url into the editor.
Next.js Demo (full example with client and server side image upload implementation)
1npm install quill-image-drop-and-paste --save
1import Quill from 'quill' 2import QuillImageDropAndPaste from 'quill-image-drop-and-paste' 3 4Quill.register('modules/imageDropAndPaste', QuillImageDropAndPaste) 5 6const quill = new Quill('#editor-container', { 7 modules: { 8 imageDropAndPaste: { 9 // add an custom image handler 10 handler: imageHandler, 11 }, 12 }, 13}) 14 15/** 16 * Do something to our dropped or pasted image 17 * @param.imageDataUrl {string} - image's dataURL 18 * @param.type {string} - image's mime type 19 * @param.imageData {ImageData} - provided more functions to handle the image 20 * - imageData.toBlob() {function} - convert image to a BLOB Object 21 * - imageData.toFile(filename?: string) {function} - convert image to a File Object. filename is optional, it will generate a random name if the original image didn't have a name. 22 * - imageData.minify(options) {function)- minify the image, return a promise 23 * - options.maxWidth {number} - specify the max width of the image, default is 800 24 * - options.maxHeight {number} - specify the max height of the image, default is 800 25 * - options.quality {number} - specify the quality of the image, default is 0.8 26 */ 27function imageHandler(imageDataUrl, type, imageData) { 28 const blob = imageData.toBlob() 29 const file = imageData.toFile() 30 31 // generate a form data 32 const formData = new FormData() 33 34 // append blob data 35 formData.append('file', blob) 36 37 // or just append the file 38 formData.append('file', file) 39 40 // upload image to your server 41 callUploadAPI(your_upload_url, formData, (err, res) => { 42 if (err) return 43 // success? you should return the uploaded image's url 44 // then insert into the quill editor 45 let index = (quill.getSelection() || {}).index 46 if (index === undefined || index < 0) index = quill.getLength() 47 quill.insertEmbed(index, 'image', res.data.image_url, 'user') 48 }) 49}
Minify image before upload to the server.
1function imageHandler(imageDataUrl, type, imageData) { 2 imageData 3 .minify({ 4 maxWidth: 320, 5 maxHeight: 320, 6 quality: 0.7, 7 }) 8 .then((miniImageData) => { 9 const blob = miniImageData.toBlob() 10 const file = miniImageData.toFile() 11 // create a form data, and upload to the server... 12 }) 13}
Additional, you could rewrite the toolbar's insert image button with our image handler.
1import { ImageData } from 'quill-image-drop-and-paste' 2 3quill.getModule('toolbar').addHandler('image', function (clicked) { 4 if (clicked) { 5 let fileInput = this.container.querySelector('input.ql-image[type=file]') 6 if (fileInput == null) { 7 fileInput = document.createElement('input') 8 fileInput.setAttribute('type', 'file') 9 fileInput.setAttribute( 10 'accept', 11 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon' 12 ) 13 fileInput.classList.add('ql-image') 14 fileInput.addEventListener('change', function (e) { 15 const files = e.target.files 16 let file 17 if (files.length > 0) { 18 file = files[0] 19 const type = file.type 20 const reader = new FileReader() 21 reader.onload = (e) => { 22 // handle the inserted image 23 const dataUrl = e.target.result 24 imageHandler(dataUrl, type, new ImageData(dataUrl, type, file.name)) 25 fileInput.value = '' 26 } 27 reader.readAsDataURL(file) 28 } 29 }) 30 } 31 fileInput.click() 32 } 33})
⚠️ Can be confused:
ImageData
fromquill-image-drop-and-paste
is different from ImageData in the Web API.
Copy dist/quill-image-drop-and-paste.min.js
into your web root or include from node_modules
1<script src="/node_modules/quill-image-drop-and-paste/quill-image-drop-and-paste.min.js"></script>
1const quill = new Quill(editorSelector, { 2 // ... 3 modules: { 4 imageDropAndPaste: { 5 // add an custom image handler 6 handler: imageHandler, 7 }, 8 }, 9}) 10 11// access ImageData 12// avoid to cover window's ImageData constructor, we should give it another name 13const QuillImageData = QuillImageDropAndPaste.ImageData
If you did not config a image handler, it will insert the image with dataURL into the quill editor directory after your drop/paste.
autoConvert
Automatic insert the image to the editor while the pasted content is an image's url(plain text). Default true
.
enableNativeUploader
Whether enable Quill's original uploader. Default false
.
handler
The image handler.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 5/25 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
122 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More