【发布时间】:2019-03-23 05:19:05
【问题描述】:
我目前正在尝试将CKeditor 5 ReactComponent 集成到我的应用中。
我遇到了上传图片功能的问题...我使用的是使用 JWT 身份验证中间件的 Node/Express 后端,因此每个请求都必须有一个 Authorization 标头才能通过。
我想知道以下其中一项是否可行:
- 向组件添加自定义标头的方法
- 一种覆盖上传处理程序并调用自定义处理程序的方法,我可以在其中做任何事情
下面是我的代码
<CKEditor
editor={ClassicEditor}
data="<p>Add product description here</p>"
onInit={(editor) => {
// You can store the "editor" and use when it is needed.
//console.log('Editor is ready to use!', editor);
}}
onChange={(event, editor) => {
const data = editor.getData();
this.handleData(data)
}}
config={{
ckfinder: {
uploadUrl: `${apiUrl}/upload/images/description`,
},
}}
/>
谢谢
【问题讨论】: