
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
quill-resize-module
Advanced tools
A module for Quill rich text editor to allow images/iframe/video and custom elements(covert to placeholder) to be resized.
A module for Quill rich text editor to allow images/iframe/video and custom elements to be resized.
This module is original forked from https://github.com/whatcould/quill-image-resize-module.
options.styles
embedTags
option for custom embed elementtools
option for custom toolbarImage resize
Embed resize (Default to iframe/video tag)
Custom any elements resize
Limit minWidth/maxWidth/minHeight/maxHeight
Limit Width/Height ratio
Selected embed element style
Direction key support
https://codesandbox.io/p/sandbox/9m9vl8
import Quill from 'quill';
import QuillResize from 'quill-resize-module';
Quill.register('modules/resize', QuillResize);
const quill = new Quill(editor, {
// ...
modules: {
// ...
resize: {
// See optional "config" below
}
}
});
Copy resize.js into your web root or include from node_modules
<script src="/node_modules/quill-resize-module/dist/resize.js"></script>
var quill = new Quill(editor, {
// ...
modules: {
// ...
resize: {
// See optional "config" below
}
}
});
For the default experience, pass an empty object, like so:
var quill = new Quill(editor, {
// ...
modules: {
// ...
resize: {}
}
});
Functionality is broken down into modules, which can be mixed and matched as you like. For example, the default is to include all modules:
const quill = new Quill(editor, {
// ...
modules: {
// ...
resize: {
modules: [ 'Resize', 'DisplaySize', 'Toolbar' ]
}
}
});
Customize the toolbar buttons with "tools" option.
For example, add handler for image alt attribute:
const quill = new Quill(editor, {
// ...
modules: {
// ...
resize: {
tools: [
'left', 'right',
{
text: 'Alt',
verify (activeEle) {
return (activeEle && activeEle.tagName === 'IMG')
},
handler (evt, button, activeEle) {
let alt = activeEle.alt || ''
alt = window.prompt('Alt for image', alt)
if (alt == null) return
activeEle.setAttribute('alt', alt)
}
}
]
}
}
});
Resize
- Resize the elementAdds handles to the element's corners which can be dragged with the mouse to resize the element.
The look and feel can be controlled with options:
var quill = new Quill(editor, {
// ...
modules: {
// ...
resize: {
// ...
// set parchment key to enable resize module
parchment: {
image: {
attribute: ['width'], // ['width', 'height']
limit: {
minWidth: 200,
maxWidth: 600,
minHeight: 200,
maxHeight: 450,
ratio: .5625 // keep width/height ratio. (ratio=height/width)
}
}
}
}
}
});
BaseModule
- Include your own custom moduleYou can write your own module by extending the BaseModule
class, and then including it in
the module setup.
For example,
import QuillResize from 'quill-resize-module';
Quill.register('modules/resize', QuillResize);
class MyModule extends QuillResize.Modules.Base {
// See src/modules/BaseModule.js for documentation on the various lifecycle callbacks
}
var quill = new Quill(editor, {
// ...
modules: {
// ...
resize: {
modules: [ MyModule, QuillResize.Modules.Resize ],
// ...
}
}
});
FAQs
A module for Quill rich text editor to allow images/iframe/video and custom elements(covert to placeholder) to be resized.
The npm package quill-resize-module receives a total of 2,490 weekly downloads. As such, quill-resize-module popularity was classified as popular.
We found that quill-resize-module demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.