vue-quill-text-editor

Quill rich text editor component encapsulated with Vue3
1,185 7
Install
npm install vue-quill-text-editor
Latest Version:1.2.5
Vue:3
License:ISC
Last Updated:Nov 8, 2022
Links: GitHub  ·  npm
Maintainer: uct8086

vue-quill-text-editor

Quill rich text editor component encapsulated with Vue3

props:

name type default
placeholder String
toolbarOptions Array official demo config
uploadFun Function rewrite image upload logic

1、install

npm install vue-quill-text-editor -D

2、import into project:

import VueQuillTextEditor from 'vue-quill-text-editor';
import 'vue-quill-text-editor/dist/vue-quill-text-editor.esm.css';

...

app.use(VueQuillTextEditor);

app.mount("#app-wrapper");

3、get quill instance:

  <vue-quill-text-editor  ref="quillRef" :placeholder="place" :uploadFun="uploadFun" />

setup() {
    const quillRef = ref();
    watch(quillRef, async (val) => {
        const quillInstance = val.quillInstance;
        quillInstance.enable(!props.disabledEdit);
        quillInstance.on('text-change', () => {
            // get html content
            const content = quillInstance.container.firstChild.innerHTML;
            console.log('quill content: ', content);
        });
        // set html content
        quillInstance.container.firstChild.innerHTML = temp;
    });
    return {
        quillRef,
        place: 'this is a test.'
    };
}

4、 image upload with Url

this is my case:

const doUpload = async (formData) => {
    try {
        // request is axios instance
        const res = await request(API.uploadImage, formData, {
            method: 'post',
            headers: {
                'Content-Type': 'multipart/form-data',
            },
        });
        return res.url;
    } catch (e) {
        console.log(e);
    }
};

const uploadFun = async (file) => {
    try {
        const oMyForm = new FormData();
        oMyForm.append('fileField', file);
        return new Promise((resolve, reject) => {
            // do some validation
            resolve(await doUpload(oMyForm));
            ...
        });
    } catch (e) {
        console.error(e);
    }
};

same as official quill, enjoy!

Related Packages

@qht/editor

富文本编辑器

1,360
vue-quill-editor-upload

a plugin for vue-quill-editor

8,894 61
vue3-quill

Quill editor for vue3

341,257 58
quill-image-resize-vue

'quill-image-resize-module's Fixed Version in Vue'

121,301 5
quill-image-extend-module

plugin for vue-quill-editor to upload image

59,862 698

Version History

Version Released Vue License
1.2.5 ^3.2.37 ISC
1.2.4 ^3.2.37 ISC
1.2.3 ^3.2.37 ISC
1.2.2 ^3.2.37 ISC
1.2.1 ^3.2.37 ISC
Pre-releases (6)
Version Released Vue License
1.0.6-alfa ^3.2.24 ISC
1.0.5-rc ^3.2.24 ISC
1.0.5-beta ^3.2.24 ISC
1.0.4-rc ^3.2.24 ISC
1.0.4-beta ^3.2.24 ISC