Gathering detailed insights and metrics for quill-blot-formatter-mobile-xlqz
Gathering detailed insights and metrics for quill-blot-formatter-mobile-xlqz
Gathering detailed insights and metrics for quill-blot-formatter-mobile-xlqz
Gathering detailed insights and metrics for quill-blot-formatter-mobile-xlqz
npm install quill-blot-formatter-mobile-xlqz
Typescript
Module System
Node Version
NPM Version
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
3
1
This is a fork of quill-blot-formatter
that adds support for touch screen on mobile devices.
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-mobile-xlqz
Using npm
:
npm install --save quill-blot-formatter-mobile-xlqz
1import Quill from 'quill'; 2 3// from the index, which exports a lot of useful modules 4import BlotFormatter from 'quill-blot-formatter-mobile-xlqz'; 5 6// or, from each individual module 7import BlotFormatter from 'quill-blot-formatter-mobile-xlqz/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-mobile-xlqz.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-mobile-xlqz/dist/quill-blot-formatter-mobile-xlqz.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-mobile-xlqz' 5 6// or, from individual modules 7import BlotFormatter from 'quill-blot-formatter-mobile-xlqz/dist/BlotFormatter'; 8import AlignAction from 'quill-blot-formatter-mobile-xlqz/dist/actions/align/AlignAction'; 9import DeleteAction from 'quill-blot-formatter-mobile-xlqz/dist/actions/DeleteAction'; 10import ImageSpec from 'quill-blot-formatter-mobile-xlqz/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.
No security vulnerabilities found.