import type { AttachmentButtonProps } from '../AttachmentButton'; import type { AttachmentButtonPopoverProps } from '../AttachmentButton/AttachmentButtonPopover'; import type { AttachmentFile } from '../types/attachment'; import type { FileUploadStatus, FileUploadSummary } from '../types/shared'; type SupportedFileFormatsType = AttachmentButtonPopoverProps['supportedFormat']; export interface FileUploadManagerProps { /** 附件配置 */ attachment?: { enable?: boolean; supportedFormat?: SupportedFileFormatsType; } & AttachmentButtonProps; /** 文件映射表 */ fileMap?: Map; /** 文件映射表变化回调 */ onFileMapChange?: (fileMap?: Map) => void; } export interface FileUploadManagerReturn { /** 文件映射表 */ fileMap?: Map; /** 文件上传是否完成 */ fileUploadDone: boolean; /** 文件上传状态 */ fileUploadStatus: FileUploadStatus; /** 文件上传状态统计 */ fileUploadSummary: FileUploadSummary; /** 支持的文件格式 */ supportedFormat: SupportedFileFormatsType; /** 上传图片 */ uploadImage: (forGallery?: boolean) => Promise; /** 更新附件文件列表 */ updateAttachmentFiles: (newFileMap?: Map) => void; /** 处理文件删除 */ handleFileRemoval: (file: AttachmentFile) => Promise; /** 处理文件重试 */ handleFileRetry: (file: AttachmentFile) => Promise; } /** * 文件上传管理器 * * @description 封装文件上传相关的逻辑,包括上传、删除、重试等操作。 * 历史位置 `src/MarkdownInputField/FileUploadManager/index.tsx` 现仅作为 * re-export 兼容层;新代码请直接从本文件导入。 */ export declare const useFileUploadManager: ({ attachment, fileMap, onFileMapChange, }: FileUploadManagerProps) => FileUploadManagerReturn; export {};