import { DecorationSet, EditorView } from '@milkdown/kit/prose/view'; import { Plugin, PluginKey, EditorState, Transaction } from '@milkdown/kit/prose/state'; export type UploadPlaceholderKind = 'image' | 'video'; export interface UploadPlaceholderAddPayload { id: string; pos: number; kind: UploadPlaceholderKind; file: File; width?: number; height?: number; /** When set, successful upload replaces this document range (e.g. video slash). */ replaceFrom?: number; replaceTo?: number; } export type UploadPlaceholderMeta = { clear: true; } | { add: UploadPlaceholderAddPayload; } | { remove: { id: string; }; }; export interface UploadPlaceholderState { decorations: DecorationSet; replaceRanges: Record; } export declare const uploadPlaceholderDecoKey: PluginKey; /** ProseMirror plugin (use in tests via `EditorState.create({ plugins: [...] })`). */ export declare function createUploadPlaceholderProsePlugin(): Plugin; export declare const uploadPlaceholderDecorationPlugin: import('@milkdown/utils').$Prose; export declare function dispatchAddUploadPlaceholder(view: EditorView, payload: UploadPlaceholderAddPayload): void; export declare function dispatchRemoveUploadPlaceholder(view: EditorView, id: string): void; export declare function clearAllUploadPlaceholders(view: EditorView): void; export declare function withRemoveUploadPlaceholderById(tr: Transaction, id: string): Transaction; /** Widget decoration range for point insert (usually from === to). */ export declare function findUploadPlaceholderWidgetRange(state: EditorState, id: string): [number, number] | null; /** Document range to replace on success when `replaceFrom`/`replaceTo` were set on add. */ export declare function getPendingReplaceRangeForId(state: EditorState, id: string): { from: number; to: number; } | undefined;