1.2.0 • Published 5 years ago
ckeditor5-images-upload v1.2.0
standard image upload button
build integration
https://docs.ckeditor.com/ckeditor5/latest/builds/guides/development/custom-builds.html
npm install --save-dev ckeditor5-images-upload
add this plugin and remove the ckfinder and easyimage plugins
// build-config.js
module.exports = {
// ...
plugins: [
'@ckeditor/ckeditor5-essentials/src/essentials',
// ...
//'@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter',
//'@ckeditor/ckeditor5-easy-image/src/easyimage',
'ckeditor5-images-upload/src/imagesUpload'
// ...
],
// ...
config: {
toolbar: {
items: [
'headings',
'bold',
'italic',
'imageUpload',
'link',
'bulletedList',
'numberedList',
'blockQuote',
'undo',
'redo'
]
},
// ...
}
}
configuration
ClassicEditor.create(document.querySelector( '#editor' ), {
imagesUpload: {
uploadUrl: 'http://127.0.0.1/my-upload-endpoint'
}
})
backend
the endpoint will receive a file named upload and should return the image url
success response :
{
"uploaded": true,
"url": "http://127.0.0.1/uploaded-image.jpeg"
}
failure response :
{
"uploaded": false,
"error": {
"message": "could not upload this image"
}
}