微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

react ckeditor5 如何将参数发送到自定义图像上传适配器?

如何解决react ckeditor5 如何将参数发送到自定义图像上传适配器?

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)
    }
}

目前,正在使用自定义适配器上传图像。上传图片时,我想向formData发送其他数据,但我不知道如何向自定义适配器发送参数。自定义适配器不能使用钩子,因为它是一个函数和类。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。