Skip to content

Modules

Modules allow Quill’s behavior and functionality to be customized. To enable a module, simply include it in a modules prop.

Example

This example uses quill-blot-formatter2, a Quill 2-compatible module for resizing and realigning images and iframe video.

Installation:

bash
npm install --save @enzedonline/quill-blot-formatter2
# OR
yarn add @enzedonline/quill-blot-formatter2

Usage:

vue
<template>
  <QuillEditor :modules="modules" toolbar="full" />
</template>

<script>
import { defineComponent } from 'vue'
import { QuillEditor } from '@vueup/vue-quill'
import BlotFormatter from '@enzedonline/quill-blot-formatter2'
import '@vueup/vue-quill/dist/vue-quill.snow.css'
import '@enzedonline/quill-blot-formatter2/dist/css/quill-blot-formatter2.css'

export default defineComponent({
  components: {
    QuillEditor,
  },
  setup: () => {
    const modules = {
      name: 'blotFormatter2',
      module: BlotFormatter, 
      options: {/* options */}
    }
    return { modules }
  },
})
</script>

Example Using quill-image-uploader

This example uses quill-image-uploader, a module for uploading images to a server instead of embedding them as base64 strings.

Installation:

bash
npm install quill-image-uploader --save

Usage:

vue
<template>
  <QuillEditor :modules="modules" toolbar="full" />
</template>

<script>
import { defineComponent } from 'vue'
import { QuillEditor } from '@vueup/vue-quill'
import ImageUploader from 'quill-image-uploader'
import '@vueup/vue-quill/dist/vue-quill.snow.css'

export default defineComponent({
  components: {
    QuillEditor,
  },
  setup: () => {
    const modules = {
      name: 'imageUploader',
      module: ImageUploader,
      options: {
        upload: async (file) => {
          const formData = new FormData()
          formData.append('image', file)

          const response = await fetch('/upload-image', {
            method: 'POST',
            body: formData,
          })
          const data = await response.json()

          return data.url
        },
      },
    }

    return { modules }
  },
})
</script>

See Quill modules docs for more details.

Registering Formats And Blots

Use a shorthand name for ordinary modules, or pass a full Quill registration path when a package exposes formats or blots that must be registered before the module.

js
import { Mention, MentionBlot } from 'quill-mention'

const modules = [
  {
    name: 'blots/mention',
    module: MentionBlot,
  },
  {
    name: 'modules/mention',
    module: Mention,
    options: {
      mentionDenotationChars: ['@'],
      source: (searchTerm, renderList) => {
        renderList([], searchTerm)
      },
    },
  },
]

modules/mention is registered as a Quill module and its options are passed to Quill as modules.mention. blots/mention is registered as a Quill blot and is not added to the module options.

If you use Quill's formats option, include the mention blot name so Quill allows mention embeds in the editor contents:

js
const options = {
  formats: ['bold', 'italic', 'mention'],
}

Quill Modules

Released under the MIT License.