Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samhammerag/ckeditor5-simple-image-upload-plugin
A generic ckeditor plugin to upload images with a custom api backend.
https://github.com/samhammerag/ckeditor5-simple-image-upload-plugin
ckeditor5
Last synced: about 1 month ago
JSON representation
A generic ckeditor plugin to upload images with a custom api backend.
- Host: GitHub
- URL: https://github.com/samhammerag/ckeditor5-simple-image-upload-plugin
- Owner: SamhammerAG
- License: mit
- Created: 2018-09-13T11:37:44.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-17T20:19:22.000Z (over 1 year ago)
- Last Synced: 2024-11-08T08:49:42.143Z (2 months ago)
- Topics: ckeditor5
- Language: JavaScript
- Homepage:
- Size: 40 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ckeditor5-simple-image-upload-plugin
[![npm version](https://badge.fury.io/js/%40samhammer%2Fckeditor5-simple-image-upload-plugin.svg)](https://www.npmjs.com/package/@samhammer/ckeditor5-simple-image-upload-plugin)
A generic ckeditor plugin to upload images with a custom api backend.
## Features
- Simple UploadAdapter to upload files with a custom backend.
## How to use
To be able to use this plugin you need a custom build of ckeditor.Further instructions can be found here:
https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/installing-plugins.htmlInstallation:
```bash
npm i @samhammer/ckeditor5-simple-image-upload-plugin
```## Configuration
This plugin uses a hook which can be configured like shown below. This hook is called with the JS-File-Object as parameter and has to return a Promise which
resolves to the full URL of the uploaded image.Example:
```js
InlineEditor
.create( editorElement, {
simpleImageUpload: {
onUpload: file => {
// do any upload stuff here with the JS-File-Object
return Promise.resolve("http://path/to/the/uploaded/image.jpg");
},
onAbort: () => { // OPTIONAL
// abort the upload here. The promise from onImageUpload should be rejected after that.
}
}
} )
.then( ... )
.catch( ... );
```## How to publish
For publishing an npm account that is referenced to the organization is required.
See the following how to:
https://docs.npmjs.com/getting-started/publishing-npm-packages
If everything is configured correctly just count up the version number in our package.json and execute one of the following commands:
```bash
npm publish --access public
```## License
ckeditor5-simple-image-upload-plugin is released under the MIT License. See LICENSE file for details.