editor config:
ClassicEditor
.create( editorElement, {
ckfinder: {
uploadUrl: '/ckfinder/upload.php' #配置上传地址
}
} )
.then( ... )
.catch( ... );
uploadUrl
response format,服务器响应格式:
{
"uploaded ": true,
"error": {
"message": "no error"
},
"url": "https://example.com/upload/images/213432434.png"
}
{
"uploaded ": false,
"error": {
"message": "file extension not allow"
},
"url": ""
}
search keywords:
- How to enable image upload support in CKEditor 5?
- How do I integrate CKFinder with CKEditor 5?
主要是官方文档有给出配置怎么写,但是没有给出服务器响应的内容格式,所以我这里写一下,给有需要的人。再者你也可以自己实现
upload
接口,看到好几篇文章都是讲的自己实现的,其实ckfinder
也是按照upload
接口实现的上传图片功能,如果能满足需求就没必要自己再重复写一遍了,自己实现可以参考官方说明https://ckeditor.com/docs/ckeditor5/latest/api/module_upload_filerepository-UploadAdapter.html。
本文链接:https://360us.net/article/65.html