
Research
/Security News
DuckDB npm Account Compromised in Continuing Supply Chain Attack
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
quill-image-compress
Advanced tools
A Quill rich text editor Module which compresses images uploaded to the editor
Quill.js Module which compresses images that are uploaded to the editor
yarn add quill-image-compress
gif|jpeg|png|svg|webp|bmp|vnd
NOTE: :exclamation: you don't need quill-image-drop-module
, it's included in this package :exclamation:
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
suppressErrorLogging: false, // default
handleOnPaste: true, //default
insertIntoEditor: undefined, // default
}
}
});
<script src="https://cdn.jsdelivr.net/npm/quill-image-compress@2.0/dist/quill.imageCompressor.min.js"></script>
<script>
Quill.register("modules/imageCompressor", imageCompressor);
var quill = new Quill("#editor", {
modules: {
imageCompressor: {
quality: 0.9,
maxWidth: 1000, // default
maxHeight: 1000, // default
imageType: 'image/jpeg'
}
}
});
</script>
[Integer] maxWidth, maxHeight
[Float] quality
[String] imageType
[Array] keepImageTypes
Preserve image type and apply quality, maxWidth, maxHeight options
[Array] ignoreImageTypes
Image types contained in this array retain their original images, do not compress them.
[Boolean] handleOnPaste
[Function] insertIntoEditor Custom function to handle inserting the image. If you wanted to upload the image to a webserver rather than embedding with Base64, you could use this function.
insertIntoEditor: (imageBase64URL, imageBlob, editor) => {
const formData = new FormData();
formData.append("file", imageBlob);
fetch("/upload", {method: "POST", body: formData})
.then(response => response.text())
.then(result => {
const range = editor.getSelection();
editor.insertEmbed(range.index, "image", `${result}`, "user");
})
.catch(error => {
console.error(error);
});
}
[Boolean] debug
This project is based on quill-image-uploader, thanks mate!
FAQs
A Quill rich text editor Module which compresses images uploaded to the editor
We found that quill-image-compress demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.