|
|
@ -1759,7 +1759,16 @@ function MyEditor(props) { |
|
|
|
|
|
|
|
// 工具栏配置 |
|
|
|
const toolbarConfig = { |
|
|
|
excludeKeys: ["emotion", "uploadImage", "uploadVideo"], |
|
|
|
// excludeKeys: [ |
|
|
|
// "emotion", |
|
|
|
// // "uploadImage", |
|
|
|
// { |
|
|
|
// key: 'group-image', // 以 group 开头 |
|
|
|
// title: '', |
|
|
|
// // iconSvg: IMAGE_SVG, |
|
|
|
// menuKeys: ['insertImage', 'uploadImage'], |
|
|
|
// }, |
|
|
|
// "uploadVideo"], |
|
|
|
}; |
|
|
|
|
|
|
|
// 编辑器配置 |
|
|
@ -1768,6 +1777,39 @@ function MyEditor(props) { |
|
|
|
MENU_CONF: {}, |
|
|
|
}; |
|
|
|
|
|
|
|
editorConfig.MENU_CONF['uploadImage'] = { |
|
|
|
// 自定义上传 |
|
|
|
customUpload(file, insertFn) { |
|
|
|
const formData = new FormData(); |
|
|
|
formData.append('file', file); |
|
|
|
let url = baseApi + "/api/com/common/file_upload" |
|
|
|
fetch(url, { |
|
|
|
method: 'POST', |
|
|
|
body: formData, |
|
|
|
headers: { |
|
|
|
Authorization: getToken(), |
|
|
|
}, |
|
|
|
}) |
|
|
|
.then((res) => { return res.json() }) |
|
|
|
.then((res) => { |
|
|
|
if (res.status == 20000) { |
|
|
|
message.success('上传成功'); |
|
|
|
insertFn(res.data, '', '') |
|
|
|
} else { |
|
|
|
message.error(res.message); |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
message.error('上传失败'); |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 及时销毁 editor ,重要! |
|
|
|
useEffect(() => { |
|
|
|
return () => { |
|
|
|