From d0af689fe9389966ca541439a8106994d8dc7021 Mon Sep 17 00:00:00 2001 From: Allen Date: Wed, 18 Aug 2021 14:12:52 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8tinymce=E6=A8=A1=E5=BC=8F=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=9B=BE=E7=89=87=E9=97=AE=E9=A2=98=20(#2395)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mock/cfc/mock/upload/image.json | 14 ++++---------- src/renderers/Form/InputRichText.tsx | 12 +++++++++++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/mock/cfc/mock/upload/image.json b/mock/cfc/mock/upload/image.json index 3e4cf0ac8..968e00a88 100755 --- a/mock/cfc/mock/upload/image.json +++ b/mock/cfc/mock/upload/image.json @@ -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" - } - } - \ No newline at end of file + "status": 0, + "msg": "ok", + "link": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg" +} diff --git a/src/renderers/Form/InputRichText.tsx b/src/renderers/Form/InputRichText.tsx index be906ce84..2a7d2f666 100644 --- a/src/renderers/Form/InputRichText.tsx +++ b/src/renderers/Form/InputRichText.tsx @@ -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) {