amis 1.6.1-beta.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,11 @@ export interface RichTextControlSchema extends FormBaseControl {
18
18
  receiver?: string;
19
19
  videoReceiver?: string;
20
20
 
21
+ /**
22
+ * 接收器的字段名
23
+ */
24
+ fileField?: string;
25
+
21
26
  /**
22
27
  * 边框模式,全边框,还是半边框,或者没边框。
23
28
  */
@@ -48,6 +53,7 @@ export default class RichTextControl extends React.Component<
48
53
  imageEditable: true,
49
54
  receiver: '/api/upload/image',
50
55
  videoReceiver: '/api/upload/video',
56
+ fileField: 'file',
51
57
  placeholder: 'placeholder.enter',
52
58
  options: {
53
59
  toolbarButtons: [
@@ -141,7 +147,11 @@ export default class RichTextControl extends React.Component<
141
147
  fail: (reason: string) => void
142
148
  ) => {
143
149
  const formData = new FormData();
144
- formData.append('file', blobInfo.blob(), blobInfo.filename());
150
+ formData.append(
151
+ props.fileField,
152
+ blobInfo.blob(),
153
+ blobInfo.filename()
154
+ );
145
155
  try {
146
156
  const receiver = {
147
157
  adaptor: (payload: object) => {
@@ -131,7 +131,11 @@ export class Log extends React.Component<LogProps, LogState> {
131
131
  if (!api.url) {
132
132
  return;
133
133
  }
134
- const res = await fetch(api.url);
134
+ const res = await fetch(api.url, {
135
+ method: api.method?.toLocaleUpperCase() || 'GET',
136
+ headers: (api.headers as Record<string, string>) || undefined,
137
+ body: api.data ? JSON.stringify(api.data) : undefined
138
+ });
135
139
  if (res.status === 200) {
136
140
  const body = res.body;
137
141
  if (!body) {