Quill editor for vue3
npm install vue3-quilljavascript
npm i vue3-quill
`
$3
`javascript
// global
import { quillEditor } from 'vue3-quill'
app.use(quillEditor)
`
$3
`javascript
// single file
import { quillEditor } from 'vue3-quill'
export default {
components: {
quillEditor
}
}
`
$3
`javascript
// global
import { quillEditor, Quill } from 'vue3-quill'
// Attention:
// customQuillModule means 'custom module name of Quill',
// not a package's name called 'customQuillModule'.
// Such as:
// import ImageUploader from "quill.imageUploader.js";
// Quill.register("modules/imageUploader", ImageUploader);
import customQuillModule from 'customQuillModule'
Quill.register('modules/customQuillModule', customQuillModule)
app.use(quillEditor)
`
$3
`javascript
import { quillEditor, Quill } from 'vue3-quill'
// Attention:
// customQuillModule means 'custom module name of Quill',
// not a package's name called 'customQuillModule'.
// Such as:
// import ImageUploader from "quill.imageUploader.js";
// Quill.register("modules/imageUploader", ImageUploader);
import customQuillModule from 'customQuillModule'
Quill.register('modules/customQuillModule', customQuillModule)
export default {
components: {
quillEditor
}
}
`
$3
`vue
v-model:value="state.content"
:options="state.editorOption"
:disabled="state.disabled"
@blur="onEditorBlur($event)"
@focus="onEditorFocus($event)"
@ready="onEditorReady($event)"
@change="onEditorChange($event)"
/>
`
Options
Form Input Bindings: v-model
The v-model directive can be used to create a two-way data binding. For example:
`vue
`
Event binding
`vue
v-model:value="state.content"
@blur="onEditorBlur($event)"
@focus="onEditorFocus($event)"
@ready="onEditorReady($event)"
@change="onEditorChange($event)"
/>
`
The following events are available:
- blur
- focus
- ready
- change
Options prop
- options
Apply the default options by not passing this prop.
The options passed in will override the default preset options.
For example:
`js
modules: {
toolbar: []
}
`
this option will generate an empty toolbar.
Check the offical doc Quill Documentation for all options.
- disabled
Default: false
Set true to disabled the editor.
As the value of readOnly when initialized.
Value changing will call API Quill Documentation of quill after initialization.
Default Quill options
`javascript
modules: {
toolbar: [
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block'],
[{ header: 1 }, { header: 2 }],
[{ list: 'ordered' }, { list: 'bullet' }],
[{ script: 'sub' }, { script: 'super' }],
[{ indent: '-1' }, { indent: '+1' }],
[{ direction: 'rtl' }],
[{ size: ['small', false, 'large', 'huge'] }],
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ color: [] }, { background: [] }],
[{ font: [] }],
[{ align: [] }],
['clean'],
['link', 'image', 'video']
]
}
`
Packages
Borrowing from: vue-quill-editor Inspired by this one.
Quill ImageHandler Module
...
Development
`shell
root dir
yarn serve
``