import { EditorState } from "prosemirror-state"; import { Decoration, DirectEditorProps, EditorProps, EditorView } from "prosemirror-view"; import { AbstractEditorView, NodeViewSet } from "./AbstractEditorView.js"; import { DOMNode, DOMSelection, DOMSelectionRange } from "./dom.js"; import { NodeViewDesc, ViewDesc } from "./viewdesc.js"; interface DOMObserver { observer: MutationObserver | null; queue: MutationRecord[]; start(): void; stop(): void; onSelectionChange(): void; } interface InputState { compositionID: number; compositionNodes: ViewDesc[]; compositionPendingChanges: number; hideSelectionGuard: (() => void) | null; lastClick: { time: number; x: number; y: number; type: string; button: number; }; lastFocus: number; lastIOSEnter: number; lastSelectionOrigin: string | null; lastSelectionTime: number; lastTouch: number; mouseDown: { allowDefault: boolean; delayedSelectionSync: boolean; }; } /** * Extends EditorView to make prop and state updates pure, remove the DOM * Mutation Observer, and use a custom document view managed by React. * * @privateRemarks * * The implementation relies on the base class using a private member to store * the committed props and having a public getter that we override to return the * latest, uncommitted props. The base class can then be told to update when the * React effects are commit an update, applying the pending, uncommitted props. */ export declare class ReactEditorView extends EditorView implements AbstractEditorView { cursorWrapper: { dom: DOMNode; deco: Decoration; } | null; nodeViews: NodeViewSet; lastSelectedViewDesc: ViewDesc | undefined; docView: NodeViewDesc; input: InputState; domObserver: DOMObserver; domSelectionRange: () => DOMSelectionRange; domSelection: () => DOMSelection | null; private nextProps; private prevState; private _destroyed; constructor(place: { mount: HTMLElement; }, props: DirectEditorProps); get props(): DirectEditorProps; /** * @privateremarks * * We override this getter because the base implementation * relies on checking `docView === null`, but we unconditionally * set view.docView in a layout effect in the DocNodeView. * This has the effect of "un-destroying" the EditorView, * making it impossible to determine whether it's been destroyed. */ get isDestroyed(): boolean; setProps(props: Partial): void; update(props: DirectEditorProps): void; updateState(state: EditorState): void; someProp(propName: PropName, f: (value: NonNullable) => Result): Result | undefined; someProp(propName: PropName): NonNullable | undefined; destroy(): void; /** * Commit effects by appling the pending props and state. * * Ensures the DOM selection is correct and updates plugin views. * * @privateRemarks * * The correctness of this depends on the pure update function ensuring that * the node view set is up to date so that it does not try to redraw. */ commitPendingEffects(): void; } export {};