Skip to content
On this page

Modules

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

Example

In this example I am gonna use quill-blot-formatter, a module for resizing and realigning images and iframe video.

Installation:

bash
npm install --save quill-blot-formatter
# OR
yarn add quill-blot-formatter

Usage:

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

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

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

Example using quill-image-uploader

In this example I am gonna use quill-image-uploader, A module for Quill rich text editor to allow images to be uploaded to a server instead of being base64 encoded.

Installation:

bash
npm install quill-image-uploader --save

Usage:

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

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

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

              axios.post('/upload-image', formData)
              .then(res => {
                console.log(res)
                resolve(res.data.url);
              })
              .catch(err => {
                reject("Upload failed");
                console.error("Error:", err)
              })
            })
          }
    return { modules }
  }
})
</script>

See Quill modules docs for more details.

Quill Modules

Released under the MIT License.