Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/renderer/src/pages/paintings/NewApiPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import { getErrorMessage, uuid } from '@renderer/utils'
import { isNewApiProvider } from '@renderer/utils/provider'
import { Avatar, Button, Empty, InputNumber, Segmented, Select, Upload } from 'antd'
import TextArea from 'antd/es/input/TextArea'
import type { RcFile } from 'antd/es/upload'
import type { UploadFile } from 'antd/es/upload/interface'
import type { FC } from 'react'
import React from 'react'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
Expand Down Expand Up @@ -553,7 +555,31 @@ const NewApiPage: FC<{ Options: string[] }> = ({ Options }) => {
maxCount={16}
showUploadList={true}
listType="picture"
beforeUpload={handleImageUpload}>
beforeUpload={handleImageUpload}
fileList={editImageFiles.map((file, idx): UploadFile<any> => {
const rcFile: RcFile = {
...file,
uid: String(idx),
lastModifiedDate: file.lastModified ? new Date(file.lastModified) : new Date()
}
return {
uid: rcFile.uid,
name: rcFile.name || `image_${idx + 1}.png`,
status: 'done',
url: URL.createObjectURL(file),
originFileObj: rcFile,
lastModifiedDate: rcFile.lastModifiedDate
}
})}
onRemove={(file) => {
setEditImageFiles((prev) =>
prev.filter((f) => {
const idx = prev.indexOf(f)
return String(idx) !== file.uid
})
)
return true
}}>
<ImagePlaceholder>
<ImageSizeImage src={IcImageUp} theme={theme} />
</ImagePlaceholder>
Expand Down