UNPKG

1.57 kBTypeScriptView Raw
1import { EditorState, Plugin, Transaction } from '@remirror/pm/state';
2import { DecorationSet } from '@remirror/pm/view';
3import { PlaceholderPluginAction } from './file-placeholder-actions';
4interface UploadPlaceholderPluginData {
5 set: DecorationSet;
6 payloads: Map<string, any>;
7}
8export declare function createUploadPlaceholderPlugin(): Plugin<UploadPlaceholderPluginData>;
9/**
10 * Try to find the positon of the placeholder in the document based on the
11 * upload placeholder id
12 *
13 * @remark
14 *
15 * This function will first try to find the position based on the decoration set.
16 * However, in some cases (e.g. `ReplaceStep`) the decoration will not be
17 * available. In that case, it will then try to find every node in the document
18 * recursively, which is much slower than the decoration set way in a large
19 * document.
20 */
21export declare function findUploadPlaceholderPos(state: EditorState, id: string): number | undefined;
22export declare function findUploadPlaceholderPayload(state: EditorState, id: string): any | undefined;
23/**
24 * Determine if there are active file uploads in the given state
25 *
26 * @remarks
27 * This utility is useful to warn users there are still active uploads before
28 * exiting or saving a document.
29 *
30 * @see https://remirror.vercel.app/?path=/story/extensions-file--with-upload-incomplete-warning
31 *
32 * @param state - the editor state
33 */
34export declare function hasUploadingFile(state: EditorState): boolean;
35export declare function setUploadPlaceholderAction(tr: Transaction, action: PlaceholderPluginAction): Transaction;
36export {};