import { FileLoader, UploadAdapter, UploadResponse } from 'ckeditor5';
/**
 * UploadAdapter 配置选项
 */
export interface UploadAdapterOptions {
    /** 上传接口地址 */
    uploadUrl: string;
    /** 自定义请求头 */
    headers?: Record<string, string> | ((file: File) => Record<string, string>);
    /** 是否携带 cookie */
    withCredentials?: boolean;
    /** 文件字段名，默认 'file' */
    fieldName?: string;
    /** 额外的表单数据 */
    extraFormData?: Record<string, string>;
}
/**
 * 创建基于 XHR 的 UploadAdapter 工厂函数
 *
 * 用法示例：
 * ```ts
 * editor.plugins.get(FileRepository).createUploadAdapter = (loader) => {
 *   return createXHRUploadAdapter(loader, {
 *     uploadUrl: 'https://api.example.com/upload',
 *     headers: { Authorization: 'Bearer token' },
 *   });
 * };
 * ```
 */
export declare function createXHRUploadAdapter(loader: FileLoader, options: UploadAdapterOptions): UploadAdapter;
/**
 * 创建 Mock UploadAdapter 工厂函数
 * 用于演示环境，无需真实后端接口
 */
export declare function createMockUploadAdapter(loader: FileLoader): UploadAdapter;
/**
 * 自定义异步上传函数类型
 * @param file 要上传的文件
 * @param updateProgress 更新上传进度的回调函数，传入 0-100 的数字
 * @returns 上传结果的 URL 字符串或 UploadResponse 对象
 */
export type AsyncUploadFunction = (file: File, updateProgress?: (percent: number) => void) => Promise<string | UploadResponse>;
/**
 * 创建基于自定义异步函数的 UploadAdapter 工厂函数
 *
 * 用法示例：
 * ```ts
 * editor.plugins.get(FileRepository).createUploadAdapter = (loader) => {
 *   return createAsyncUploadAdapter(loader, async (file, updateProgress) => {
 *     // 1. 向后端请求预签名 URL
 *     const { uploadUrl, finalUrl } = await fetchPresignedUrl(file.name);
 *
 *     // 2. 使用 XMLHttpRequest 上传到对象存储，可监听进度
 *     await uploadToStorage(file, uploadUrl, (percent) => {
 *       updateProgress?.(percent);
 *     });
 *
 *     // 3. 返回最终文件 URL
 *     return finalUrl;
 *   });
 * };
 * ```
 */
export declare function createAsyncUploadAdapter(loader: FileLoader, uploadFn: AsyncUploadFunction): UploadAdapter;
//# sourceMappingURL=uploadAdapter.d.ts.map