npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-quill-component

v1.0.4

Published

A Vue.js component for a Quill editor

Downloads

7

Readme

🖋 vue-quill-component

This is a Vue.js component that wraps and manages an instance of Quill.

Install

yarn add quill@1 vue-quill-component

Note that quill version 1.x is a peer dependency rather than a direct dependency, so don't forget to install it as well. In making it a peer dependency, you have the choice on what version you want to use and stay in control of the Quill class.

Usage

Simply import the component and use it in your template, binding some contents to it:

Example

<template>
    <div>
        <h1>Editor</h1>
        <editor v-model="contents" />
    </div>
</template>

<script>
    import VueQuill from 'vue-quill-component'
    
    export default {
        components: {
            editor: VueQuill
        },
        data() {
            return {
                contents: { ops: [] },
            };
        },
    }
</script>

<style>
    /* You can choose which parts of the Quill CSS you want to use. */
    @import '~quill/dist/quill.core.css';
</style>

Registration of formats and modules happens using the Quill class, which is shared between components. Make sure you register your extensions before the editor component is mounted.

import Quill from 'quill';
import CustomFormat from 'src/CustomFormat.js';

Quill.register('formats/myFormat', CustomFormat);

Component definition

Model

The component supports v-model to sync the contents property. The component models changes to this property to an input event.

<editor v-model="contents"/>

If you don't want to use the v-model directive, you'll have to bind contents and update its value on @input:

<editor :contents="contents" @input="(value) => {contents = value}"/>

Properties

contents: Object = {ops: []}

The contents of the editor. This can be an instance of Delta or a plain object that represents the Delta format. You can also bind this property via v-model.

editorTabIndex: Number

If given, sets a tabindex on the Quill instance's root scroll element.

formats: Array = []

A whitelist of all format names to allow. If not given, no formats are allowed. See Quill's formats option.

isReadOnly: Boolean = false

If true, the user will be unable to edit the contents of the editor. This property uses Quill’s enable method.

modules: Object = {}

A collection of modules to be used by the Quill editor instance. See Quill's modules option.

options: Object

All configuration options to pass to Quill when it initializes the editor.

Note: You have the choice to pass most options such as theme, modules and placeholder directly as a property on the component rather than via this options property. Options passed directly as a property will always override priority over those passed in this option object.

placeholder: String

A placeholder to display when the editor has no content. See Quill's placeholder option.

theme: String

The name of the theme to use. Any falsey value will load Quill's core theme. See Quill's theme option.

Events

input

Emitted when contents is updated.

The callback receives the new contents.

callback(contents: Delta)

changeContent

Emitted when the Quill instance emits editor-change with a name of text-change.

The callback receives the change to the content, the current and previous contents, the source of the change and the editor instance the change occured in.

callback(change: Delta, contents: Delta, previousContents: Delta, source: String, editor: Quill)

changeSelection

Emitted when the Quill instance emits editor-change with a name of selection-change.

The callback receives the current and previous range, the source of the change in selection and the editor instance the change occured in.

callback(range: Range, previousRange: Range, source: String, editor: Quill)

focus

Emitted when the editor gains focus.

The callback receives the range at which the editor gained focus, the source that caused focus on the editor and the editor instance itself.

callback(range: Range, source: String, editor: Quill)

blur

Emitted when the editor loses focus.

The callback receives the range at which the editor lost focus, the source that caused the editor to lose focus and the editor instance itself.

callback(previousRange: Range, source: String, editor: Quill)

Methods

You can call the following instance methods via a ref to the component.

focus()

Focus on the editor.

Example
<template>
    <button @click="focusOnEditor">Focus!</button>
    <VueQuill ref="editor"/>
</template>

<script>
    import VueQuill from 'vue-quill-component';
    
    export default {
        components: {
            VueQuill,
        }
        methods: {
            focusOnEditor() {
                this.$refs.editor.focus();
            },
        },
    }
</script>

blur()

Remove focus from the editor.