Sonke
Sonke

Reputation: 35

Image Upload in ckeditor5-react

I have been seeking for any thread with the related issue, but couldn't find one, I'm trying to set an image upload for ckeditor5-react, picking up a file via file browser works fine but I get an alert "cannot upload file"

Here is my code below:

<CKEditor
    editor={ ClassicEditor } 
    onChange={ ( event, editor ) => console.log( { event, editor } ) }
    config={{
         ckfinder:{uploadUrl: "/uplaodImageFromEditor"}
      }}
    UploadAdapter={FileRepository}
 />

Upvotes: 2

Views: 14954

Answers (1)

Maciej Bukowski
Maciej Bukowski

Reputation: 3348

First of all, there's no UploadAdapter property available in the CKEditor component.

Secondly, the image feature is based on the image upload, so you need to configure your backend, so the uploaded images can be stored somewhere. As it's explained in the How to enable image upload support in CKEditor 5?, so you have a few options.

If you want to use the CKFinder, then you need to install the CKFinder and provide a correct URL in the ckfinder.uploadUrl config. Eventually, you can use this URL as the endpoint for your own backend - see how the backend responses should look like for the ckfinder.uploadUrl config.

Upvotes: 4

Related Questions