1.2.5 • Published 2 years ago

vue-quill-text-editor v1.2.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

vue-quill-text-editor

Quill rich text editor component encapsulated with Vue3

props:

nametypedefault
placeholderString
toolbarOptionsArrayofficial demo config
uploadFunFunctionrewrite 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!

1.2.5

2 years ago

1.2.4

2 years ago

1.2.0

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.6

2 years ago

1.0.6-alfa

2 years ago

1.0.5

2 years ago

1.0.5-rc

2 years ago

1.0.5-beta

2 years ago

1.0.4

2 years ago

1.0.4-rc

2 years ago

1.0.4-beta

2 years ago

1.0.4-alfa

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago