UNPKG

quill-uploader

Version:

Quill custom Uploader, supports images, videos, and attachments, with customizable loading indicators.

49 lines (48 loc) 1.66 kB
import _Quill, { Delta, Parchment, Range } from 'quill'; type FileLike = File & { base64?: string; key?: string; thumb?: string; }; interface UploaderOptions { handler?: (files: FileLike[]) => Promise<FileLike[]> | FileLike[]; upload: (range: Range, files: FileLike[], progress: (error: any, result: any) => void) => Promise<any[]>; accepts?: Record<string, string[]>; imagePreload?: boolean; focusOnDone?: boolean; } type DomRange = Range & { blot?: Parchment.Blot; delta?: Delta; }; declare class CustomUploader { static DefaultFilePlaceholder: string; static DefaultAttachmentPlaceholder: string; static Accepts: Record<string, string[]>; static Events: { start: string; done: string; }; static findType(mime: string, accepts?: Record<string, string[]>): string; static register(): void; quill: _Quill; options: UploaderOptions; constructor(quill: _Quill, options: UploaderOptions); clipboardInit(): void; pickFile(type: string): void; insertPlaceholder(range: DomRange, url: any): Delta; insertFilePlaceholder(range: DomRange, file: FileLike): Promise<unknown>; calculatePlaceholderInsertLength(delta: any): any; getLoadingDomRange(key: string): DomRange; loadImage(res: any): Promise<unknown>; insertToEditor(res: any): Promise<{ length: number; index: number; blot?: Parchment.Blot; delta?: Delta; }>; removePlaceholder(res: any): void; uploadFiles(range: DomRange, filesArg: FileList | File[]): Promise<void>; done(range: any, results: any): void; } export default CustomUploader;