react ckeditor5 How can I send parameters to a custom image upload adapter?

Viewed 93
editor

<CKEditor
    editor={ ClassicEditor }
    onReady={e => {                       
        _initCkEditorObj(e) 
    }}
    config={{
       placeholder: 'write Text!.',
       removePlugins:['ImageCaption', 'MediaEmbed'],
       extraPlugins: [MyUploadAdapterPlugin]
    }}
/> 

MyUploadAdapterPlugin

class CkeditorUploadAdapter {
    constructor( loader ) {
       // Here, I want to initialize after receiving other data including loaders.
    }

}
export function MyUploadAdapterPlugin(editor) {
    editor.plugins.get('FileRepository').createUploadAdapter = (loader) => {
        // Configure the URL to the upload script in your back-end here!
        return new CkeditorUploadAdapter(loader)
    }
}

Currently, images are being uploaded using custom adapters. When uploading an image, I want to send other data to formData, but I don't know how to send parameters to the custom adapter. The custom adapter cannot use hooks because it is a function and class.

0 Answers
Related