UNPKG

@gaoding/editor-sdk

Version:

稿定编辑器对外 SDK

52 lines (51 loc) 1.57 kB
interface Config { appId: string; container?: string; onCloseModal?: () => Promise<void | boolean> | void | boolean; /** * 获取使用权益凭证 */ getUseRightCert?(info: { appId: string; abilityCode: string; workId: string; }): Promise<string | false | Error>; /** * 获取用户授权标识 */ authorize?(): Promise<string>; } type EditorModuleType = 'panel.template' | 'panel.ajustment' | 'panel.mark' | 'panel.text' | 'panel.border' | 'panel.element' | 'panel.watermark' | 'panel.upload'; export declare function createImageEditor(config: Config): { editImage: (id: string, options?: { disableModules?: EditorModuleType[]; fileTypes?: string[]; }) => Promise<false | { files: Blob[]; workId: number; title: string; type: string; }>; close: () => void; onSave: (fn: (info: { workId: string; files: Blob[]; title: string; type: string; indexes?: number[]; sourceIndexes?: number[]; }) => void) => void; onClose: (fn: () => any) => void; importImage: (file: (string | Blob) | (string | Blob)[], options?: { disableModules?: EditorModuleType[]; fileTypes?: string[]; }) => Promise<false | { files: Blob[]; workId: number; title: string; type: string; }>; on: (eventName: string, fn: (...args: any[]) => any) => void; off: (eventName: string, fn: (...args: any[]) => any) => void; }; export {};