Skip to content

Updated Modules docs #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions docs/content/guide/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,58 @@ export default defineComponent({
})
</script>
~~~
## Example using quill-image-uploader
In this example I am gonna use [quill-image-uploader](https://github.com/NoelOConnell/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](https://quilljs.com/docs/modules/) for more details.

Expand Down