UNPKG

1.14 kBTypeScriptView Raw
1import { NodeType } from '@remirror/pm/model';
2import { EditorView } from '@remirror/pm/view';
3import { FileUploader } from './file-uploader';
4import { UploadContext } from './upload-context';
5/**
6 * Any `ProsemirrorNode` can use the `uploadFile` function in this file as long
7 * as its attributes implement this interface.
8 */
9interface AbstractNodeAttributes {
10 id?: any;
11 error?: string | null;
12}
13export declare type UploadFileHandler<NodeAttributes> = () => FileUploader<NodeAttributes>;
14export interface UploadPlaceholderPayload<NodeAttributes extends AbstractNodeAttributes> {
15 context: UploadContext;
16 fileUploader: FileUploader<NodeAttributes>;
17}
18export interface UploadFileProps<NodeAttributes extends AbstractNodeAttributes = object> {
19 file: File;
20 pos: number | undefined;
21 view: EditorView;
22 fileType: NodeType;
23 uploadHandler: UploadFileHandler<NodeAttributes>;
24}
25/**
26 * Insert a file into the editor and upload it.
27 */
28export declare function uploadFile<NodeAttributes extends AbstractNodeAttributes>({ file, pos, view, fileType, uploadHandler, }: UploadFileProps<NodeAttributes>): void;
29export {};