Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/plotdb/quill-uploader
https://github.com/plotdb/quill-uploader
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/plotdb/quill-uploader
- Owner: plotdb
- Created: 2024-12-13T14:38:39.000Z (13 days ago)
- Default Branch: master
- Last Pushed: 2024-12-13T14:55:29.000Z (13 days ago)
- Last Synced: 2024-12-13T16:18:19.766Z (13 days ago)
- Language: LiveScript
- Size: 79.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# @plotdb/quill-uploader
Upload Manager for Quill.js. It's a abstract interface for which you should still implement the upload function to handle the upload request.
## Installation
Install @plotdb/quill-uploader and its dependencies via npm:
npm install --save @plotdb/quill-uploader ldfile @loadingio/debounce.js
## Usage
include js file:
create a quill-uploader instance:
uploadr = new quillUploader(opt)
where `opt` is an object with the following properties:
- `upload`: a function that handles upload request.
- request is handled by accepting an object with following params:
- `file`: file blob to upload which should provide following fields:
- `name`, `size`, `type`, `lastModified`
- `progress`: a callback function that accepts upload progress between 0 ~ 1.
- it should return a Promise which resolves with an object with following fields:
- `filename`: file name.
- `size`: file size.
- `modifiedtime`: last modified time of this file.
- `url`: where we can find the uploaded version of this file.then, use it to construct a Quill instance:
new Quill(node, {
modules: { toolbar: {
handlers: {
image: uploadr.handler.upload({type:"image"}),
upload: uploadr.handler.upload({type:"file"})
}
}}
})and watch for `uploaded` event which will be fired with a file blob object when the file is successfully uploaded:
uploader.on("uploaded", function(file) { ... });
## License
MIT