fix:富文本编辑器tinymce模式上传图片问题 (#2395)

This commit is contained in:
Allen 2021-08-18 14:12:52 +08:00 committed by GitHub
parent 3d9ce28ae9
commit d0af689fe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View File

@ -1,11 +1,5 @@
{
"status": 0,
"msg": "ok",
"data": {
"value":
"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg",
"url": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg",
"filename": "dog.jpg"
}
}
"status": 0,
"msg": "ok",
"link": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg"
}

View File

@ -3,6 +3,7 @@ import {FormItem, FormControlProps, FormBaseControl} from './Item';
import cx from 'classnames';
import LazyComponent from '../../components/LazyComponent';
import {tokenize} from '../../utils/tpl-builtin';
import {normalizeApi} from '../../utils/api';
/**
* RichText
@ -189,7 +190,16 @@ export default class RichTextControl extends React.Component<
const formData = new FormData();
formData.append('file', blobInfo.blob(), blobInfo.filename());
try {
const response = await fetcher(props.receiver, formData, {
const receiver = {
adaptor: (payload: object) => {
return {
...payload,
data: payload
};
},
...normalizeApi(props.receiver)
};
const response = await fetcher(receiver, formData, {
method: 'post'
});
if (response.ok) {