Gathering detailed insights and metrics for quill-blot-formatter
Gathering detailed insights and metrics for quill-blot-formatter
Gathering detailed insights and metrics for quill-blot-formatter
Gathering detailed insights and metrics for quill-blot-formatter
@enzedonline/quill-blot-formatter2
An update for quill-blot-formatter to make quilljs v2 compatible.
parchment
A document model for rich text editors
quill-blot-formatter-2
a module for the Quill text editor to allow blots to be reformatted. Built in formatters: resize and realign. Built in blot support: images and iframe videos.
quill-blot-formatter-mobile
a module for the Quill text editor to allow blots to be reformatted. Built in formatters: resize and realign. Built in blot support: images and iframe videos.
npm install quill-blot-formatter
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
135 Stars
103 Commits
50 Forks
1 Watching
1 Branches
2 Contributors
Updated on 30 Sept 2024
JavaScript (94.9%)
HTML (5.1%)
Cumulative downloads
Total Downloads
Last day
-12.2%
4,231
Compared to previous day
Last week
-10.6%
24,820
Compared to previous week
Last month
20.4%
115,843
Compared to previous month
Last year
6.4%
1,196,630
Compared to previous year
A quill module to format document blots. Heavily inspired by quill-image-resize-module. Out of the box supports resizing and realigning images and iframe videos, but can be easily extended using BlotSpec
and Action
.
Using yarn
:
yarn add quill-blot-formatter
Using npm
:
npm install --save quill-blot-formatter
1import Quill from 'quill'; 2 3// from the index, which exports a lot of useful modules 4import BlotFormatter from 'quill-blot-formatter'; 5 6// or, from each individual module 7import BlotFormatter from 'quill-blot-formatter/dist/BlotFormatter'; 8 9Quill.register('modules/blotFormatter', BlotFormatter); 10 11const quill = new Quill(..., { 12 modules: { 13 ... 14 blotFormatter: { 15 // see config options below 16 } 17 } 18});
quill-blot-formatter.min.js
is provided which exports the same modules as index.js
under the global QuillBlotFormatter
.
1<script src="<quill>"></script> 2<script src="node_modules/quill-blot-formatter/dist/quill-blot-formatter.min.js"></script> 3<script> 4 Quill.register('modules/blotFormatter', QuillBlotFormatter.default); 5 const quill = new Quill(..., { 6 modules: { 7 ... 8 blotFormatter: { 9 // see config options below 10 } 11 } 12 } 13 }); 14</script>
The BlotSpec
classes define how BlotFormatter
interacts with blots. They take the BlotFormatter
as a constructor arg and have the following functions:
init(): void
Called after all specs have been constructed. Use this to bind to quill events to determine when to activate a specific spec.
getActions(): Class<Action>[]
The actions
that are allowed on this blot. The default is [AlignAction, ResizeAction, DeleteAction]
.
getTargetElement(): ?HTMLElement
When the spec is active this should return the element that is to be formatter
getOverlayElement(): ?HTMLElement
When the spec is active this should return the element to display the formatting overlay. This defaults to return getTargetElement()
since they will typically be the same element.
setSelection(): void
After the spec is activated this should set the quill selection using setSelection
. Defaults to quill.setSelection(null)
.
onHide(): void
Called when the spec is deactivated by the user clicking away from the blot. Use this to clean up any state in the spec during activation.
Each spec should call this.formatter.show(this);
to request activation. See specs/
for the built-in specs.
The Action
classes define the actions available to a blot once its spec is activated. They take the BlotFormatter
as a constructor arg and have the following functions:
onCreate(): void
Called immediately after the action is created. Use this to bind quill events and create elements to attach to the overlay.
onUpdate(): void
Called when the formatter has changed something on the blot. Use this to update any internal state.
onDestroy(): void
Called when the formatter is hidden by the user.
See actions/
for the existing actions.
Using quill module options it's easy to disable existing specs, actions, or to override any of the styles provided by this module. For example: if you wanted to remove resizing, support only images, and change the overlay border the following config would work:
1import Quill from 'quill'; 2 3// from main module 4import BlotFormatter, { AlignAction, DeleteAction, ImageSpec } from 'quill-blot-formatter' 5 6// or, from individual modules 7import BlotFormatter from 'quill-blot-formatter/dist/BlotFormatter'; 8import AlignAction from 'quill-blot-formatter/dist/actions/align/AlignAction'; 9import DeleteAction from 'quill-blot-formatter/dist/actions/DeleteAction'; 10import ImageSpec from 'quill-blot-formatter/dist/specs/ImageSpec'; 11 12Quill.register('modules/blotFormatter', BlotFormatter); 13 14class CustomImageSpec extends ImageSpec { 15 getActions() { 16 return [AlignAction, DeleteAction]; 17 } 18} 19 20const quill = new Quill(..., { 21 modules: { 22 ... 23 blotFormatter: { 24 specs: [ 25 CustomImageSpec, 26 ], 27 overlay: { 28 style: { 29 border: '2px solid red', 30 } 31 } 32 } 33 } 34});
Options
.overlay.style
, resize.handleStyle
, etc) set those to null
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/26 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
62 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
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