Convert Figma logo to code with AI

surmon-china logovue-quill-editor

@quilljs editor component for @vuejs(2)

7,373
1,028
7,373
263

Top Related Projects

43,470

Quill is a modern WYSIWYG editor built for compatibility and extensibility

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.

14,968

The world's #1 JavaScript library for rich text editing. Available for React, Vue and Angular

Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.

22,566

A React framework for building text editors.

18,951

A rich text editor for everyday writing

Quick Overview

vue-quill-editor is a Vue component wrapper for the Quill rich text editor. It provides an easy-to-use interface for integrating Quill into Vue applications, offering full customization options and support for both Vue 2 and Vue 3.

Pros

  • Easy integration with Vue projects
  • Supports both Vue 2 and Vue 3
  • Highly customizable with full access to Quill's API
  • Reactive two-way binding for content

Cons

  • Depends on the Quill library, which may increase bundle size
  • Limited built-in themes (requires custom CSS for advanced styling)
  • May have a learning curve for users unfamiliar with Quill

Code Examples

  1. Basic usage:
<template>
  <quill-editor v-model="content" />
</template>

<script>
import { QuillEditor } from 'vue-quill-editor'

export default {
  components: { QuillEditor },
  data() {
    return {
      content: '<h1>Hello, Quill!</h1>'
    }
  }
}
</script>
  1. Custom toolbar:
<template>
  <quill-editor v-model="content" :options="editorOptions" />
</template>

<script>
import { QuillEditor } from 'vue-quill-editor'

export default {
  components: { QuillEditor },
  data() {
    return {
      content: '',
      editorOptions: {
        modules: {
          toolbar: [
            ['bold', 'italic', 'underline'],
            [{ 'list': 'ordered'}, { 'list': 'bullet' }],
            ['link', 'image']
          ]
        }
      }
    }
  }
}
</script>
  1. Event handling:
<template>
  <quill-editor
    v-model="content"
    @ready="onEditorReady"
    @text-change="onTextChange"
  />
</template>

<script>
import { QuillEditor } from 'vue-quill-editor'

export default {
  components: { QuillEditor },
  data() {
    return {
      content: ''
    }
  },
  methods: {
    onEditorReady(quill) {
      console.log('Editor is ready!', quill)
    },
    onTextChange({ quill, html, text }) {
      console.log('Text changed!', html, text)
    }
  }
}
</script>

Getting Started

  1. Install the package:

    npm install vue-quill-editor
    
  2. Import and use the component:

    <template>
      <quill-editor v-model="content" />
    </template>
    
    <script>
    import { QuillEditor } from 'vue-quill-editor'
    
    export default {
      components: { QuillEditor },
      data() {
        return {
          content: '<p>Hello, Quill!</p>'
        }
      }
    }
    </script>
    
  3. Import the required CSS:

    import 'quill/dist/quill.core.css'
    import 'quill/dist/quill.snow.css'
    import 'quill/dist/quill.bubble.css'
    

Competitor Comparisons

43,470

Quill is a modern WYSIWYG editor built for compatibility and extensibility

Pros of Quill

  • More comprehensive and feature-rich, offering a wider range of text editing capabilities
  • Actively maintained with regular updates and improvements
  • Larger community and ecosystem, providing better support and resources

Cons of Quill

  • Steeper learning curve due to its extensive feature set
  • Potentially heavier and more resource-intensive for simpler use cases
  • May require more configuration and setup compared to Vue-specific solutions

Code Comparison

Vue-quill-editor:

<template>
  <quill-editor v-model="content" :options="editorOption"></quill-editor>
</template>

<script>
import { quillEditor } from 'vue-quill-editor'
</script>

Quill:

var quill = new Quill('#editor', {
  theme: 'snow'
});

quill.on('text-change', function(delta, oldDelta, source) {
  console.log('Text change!');
});

Summary

Quill is a more robust and feature-rich text editor library, while Vue-quill-editor is a Vue-specific wrapper for Quill. Quill offers more flexibility and customization options but may be overkill for simpler projects. Vue-quill-editor provides an easier integration with Vue.js applications but might have limitations in advanced use cases. The choice between the two depends on the specific requirements of your project and your familiarity with Vue.js ecosystem.

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.

Pros of CKEditor 5

  • More feature-rich and customizable out of the box
  • Better support for collaborative editing
  • Stronger accessibility compliance

Cons of CKEditor 5

  • Steeper learning curve for implementation
  • Larger file size and potentially slower load times
  • More complex licensing structure

Code Comparison

CKEditor 5 (React integration):

import { CKEditor } from '@ckeditor/ckeditor5-react';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';

<CKEditor
    editor={ ClassicEditor }
    data="<p>Hello from CKEditor 5!</p>"
    onReady={ editor => {
        // You can store the "editor" and use when it is needed.
        console.log( 'Editor is ready to use!', editor );
    } }
/>

vue-quill-editor:

<template>
  <quill-editor v-model="content"
                ref="myQuillEditor"
                :options="editorOption">
  </quill-editor>
</template>

<script>
import { quillEditor } from 'vue-quill-editor'

export default {
  components: { quillEditor },
  data() {
    return {
      content: '<p>Hello from Quill!</p>',
      editorOption: { /* quill options */ }
    }
  }
}
</script>

Both editors offer robust rich text editing capabilities, but CKEditor 5 provides more advanced features at the cost of increased complexity. vue-quill-editor is simpler to implement and lighter-weight, making it a good choice for projects with basic editing needs.

14,968

The world's #1 JavaScript library for rich text editing. Available for React, Vue and Angular

Pros of TinyMCE

  • More feature-rich and customizable, offering a wider range of plugins and options
  • Better cross-browser compatibility and support for older browsers
  • Stronger community support and regular updates

Cons of TinyMCE

  • Larger file size and potentially slower load times
  • Steeper learning curve for implementation and customization
  • Commercial license required for some features and advanced usage

Code Comparison

TinyMCE (JavaScript):

tinymce.init({
  selector: '#myTextarea',
  plugins: 'advlist autolink lists link image charmap print preview',
  toolbar: 'undo redo | formatselect | bold italic | alignleft aligncenter alignright | bullist numlist outdent indent | link image'
});

vue-quill-editor (Vue.js):

<template>
  <quill-editor v-model="content" :options="editorOption"></quill-editor>
</template>

<script>
export default {
  data() {
    return {
      content: '',
      editorOption: {
        modules: { toolbar: [['bold', 'italic'], ['link', 'image']] }
      }
    }
  }
}
</script>

Both editors offer rich text editing capabilities, but TinyMCE provides more out-of-the-box features and customization options. vue-quill-editor, being Vue-specific, offers easier integration with Vue.js projects and a simpler setup process. TinyMCE's implementation is more verbose but allows for greater control, while vue-quill-editor's approach is more concise and Vue-friendly.

Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.

Pros of medium-editor

  • Framework-agnostic: Can be used with any JavaScript framework or vanilla JS
  • Lightweight and customizable: Offers a more minimalistic approach with extensible options
  • WYSIWYG editing: Provides inline editing similar to Medium's editor

Cons of medium-editor

  • Less feature-rich: Fewer built-in formatting options compared to vue-quill-editor
  • Maintenance: Less actively maintained, with fewer recent updates
  • Vue integration: Requires additional work to integrate with Vue.js applications

Code comparison

medium-editor:

var editor = new MediumEditor('.editable', {
  toolbar: {
    buttons: ['bold', 'italic', 'underline', 'anchor', 'h2', 'h3', 'quote']
  }
});

vue-quill-editor:

<template>
  <quill-editor v-model="content" :options="editorOption"></quill-editor>
</template>

<script>
export default {
  data() {
    return {
      content: '',
      editorOption: {
        modules: {
          toolbar: [
            ['bold', 'italic', 'underline'],
            ['link', 'image'],
            [{ 'header': [1, 2, 3, false] }]
          ]
        }
      }
    }
  }
}
</script>

The code comparison shows that medium-editor is initialized with plain JavaScript, while vue-quill-editor is used as a Vue component with more structured configuration options.

22,566

A React framework for building text editors.

Pros of Draft.js

  • More flexible and customizable, allowing for complex text editing features
  • Better support for collaborative editing and real-time updates
  • Stronger TypeScript support and integration

Cons of Draft.js

  • Steeper learning curve and more complex implementation
  • Less out-of-the-box functionality compared to Vue-Quill-Editor
  • Requires more setup and configuration for basic use cases

Code Comparison

Draft.js:

import { Editor, EditorState } from 'draft-js';

const [editorState, setEditorState] = useState(EditorState.createEmpty());

<Editor editorState={editorState} onChange={setEditorState} />

Vue-Quill-Editor:

<template>
  <quill-editor v-model="content" />
</template>

<script>
import { QuillEditor } from 'vue-quill-editor'

export default {
  components: { QuillEditor },
  data() {
    return {
      content: ''
    }
  }
}
</script>

Draft.js provides a more low-level API, giving developers greater control over the editor's behavior and appearance. Vue-Quill-Editor, on the other hand, offers a simpler implementation with pre-built functionality, making it easier to set up and use for basic text editing needs. The choice between the two depends on the specific requirements of the project and the level of customization needed.

18,951

A rich text editor for everyday writing

Pros of Trix

  • Standalone editor with no dependencies, easier to integrate
  • Built-in file attachment handling and image uploading
  • More lightweight and focused on essential editing features

Cons of Trix

  • Less customizable compared to Quill-based solutions
  • Fewer formatting options and advanced features out-of-the-box
  • Smaller community and ecosystem around the project

Code Comparison

Trix:

<trix-editor class="trix-content"></trix-editor>
<script>
  document.addEventListener("trix-initialize", function(event) {
    var editor = event.target;
    // Customize editor here
  });
</script>

vue-quill-editor:

<template>
  <quill-editor v-model="content" :options="editorOption"></quill-editor>
</template>
<script>
export default {
  data() {
    return {
      content: '',
      editorOption: {
        // Quill options
      }
    }
  }
}
</script>

Both editors offer simple integration, but vue-quill-editor is specifically designed for Vue.js applications, while Trix can be used in various environments. Trix provides a more straightforward setup, while vue-quill-editor offers more customization options through its configuration object.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

vue-quill-editor

vue   GitHub stars   GitHub issues   npm   license

Quill editor component for Vue(2).


DEPRECATED ‼️

Unfortunately, since the Quill project has effectively stopped being maintained, vue-quill-editor will be DEPRECATED and will no longer support Vue3; if you're looking for a rich text editor, I recommend migrating to tiptap, which is a much better alternative.

If Quill ever updates v2.0, this project will probably continue to be updated as well. I encourage folks to fork this repository and, if a fork gets popular, I will link to it in this README.

The stalled Quill project can be found in these issues:


Example

Documentation

Install

NPM

npm install vue-quill-editor --save
yarn add vue-quill-editor

CDN

<link rel="stylesheet" href="path/to/quill.core.css"/>
<link rel="stylesheet" href="path/to/quill.snow.css"/>
<link rel="stylesheet" href="path/to/quill.bubble.css"/>
<script type="text/javascript" src="path/to/quill.js"></script>
<script type="text/javascript" src="path/to/vue.min.js"></script>
<script type="text/javascript" src="path/to/dist/vue-quill-editor.js"></script>
<script type="text/javascript">
  Vue.use(window.VueQuillEditor)
</script>

Usage

Global component

import Vue from 'vue'
import VueQuillEditor from 'vue-quill-editor'

import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme

Vue.use(VueQuillEditor, /* { default global options } */)

Local component

import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

import { quillEditor } from 'vue-quill-editor'

export default {
  components: {
    quillEditor
  }
}

SSR component

See Nuxt.js example code.

Register Quill module

import Quill from 'quill'
import yourQuillModule from '../yourModulePath/yourQuillModule.js'
Quill.register('modules/yourQuillModule', yourQuillModule)

// Vue app...

Component

<template>
  <!-- Two-way Data-Binding -->
  <quill-editor
    ref="myQuillEditor"
    v-model="content"
    :options="editorOption"
    @blur="onEditorBlur($event)"
    @focus="onEditorFocus($event)"
    @ready="onEditorReady($event)"
  />

  <!-- Or manually control the data synchronization -->
  <quill-editor
    :content="content"
    :options="editorOption"
    @change="onEditorChange($event)"
  />
</template>

<script>
  // You can also register Quill modules in the component
  import Quill from 'quill'
  import someModule from '../yourModulePath/someQuillModule.js'
  Quill.register('modules/someModule', someModule)
  
  export default {
    data () {
      return {
        content: '<h2>I am Example</h2>',
        editorOption: {
          // Some Quill options...
        }
      }
    },
    methods: {
      onEditorBlur(quill) {
        console.log('editor blur!', quill)
      },
      onEditorFocus(quill) {
        console.log('editor focus!', quill)
      },
      onEditorReady(quill) {
        console.log('editor ready!', quill)
      },
      onEditorChange({ quill, html, text }) {
        console.log('editor change!', quill, html, text)
        this.content = html
      }
    },
    computed: {
      editor() {
        return this.$refs.myQuillEditor.quill
      }
    },
    mounted() {
      console.log('this is current quill instance object', this.editor)
    }
  }
</script>

Issues

Quill Modules

Changelog

Detailed changes for each release are documented in the release notes.

License

Licensed under the MIT License.

NPM DownloadsLast 30 Days