/** * Undo, scoped to the local peer. * * `prosemirror-history` is wrong for a collaborative document and wrong in a * way that is easy to miss: its stack is a list of *steps applied to this * editor*, so a remote peer's paragraph and an agent's rewrite are both on it. * `Cmd+Z` then deletes someone else's work. This is the bug `06-editor.md` * calls out by name. * * Loro's `UndoManager` is bound to one peer id and cannot revert another peer's * changes — it rebases its stack over them instead. So when a CRDT is bound, * the editor must not install its own history plugin; `@delightstack/editor` * exposes the `history` option as exactly that seam. */ import { Plugin, PluginKey, type Command, type EditorState } from 'prosemirror-state'; import { UndoManager } from '../loro.client.js'; /** Undo steps closer together than this merge into one. Loro's own default. */ export declare const DEFAULT_UNDO_MERGE_INTERVAL_MS = 1000; /** How many undo steps are retained. Loro's own default. */ export declare const DEFAULT_MAX_UNDO_STEPS = 100; export interface LoroUndoOptions { merge_interval_ms?: number; max_steps?: number; } export interface LoroUndoState { manager: UndoManager; } export declare const loroUndoKey: PluginKey; /** * The undo plugin. Must be installed **after** {@link loroSync}, whose state it * reads to find the document — `loroPlugins()` does that ordering for you. */ export declare function loroUndo(options?: LoroUndoOptions): Plugin; /** ProseMirror command: undo this peer's last edit. */ export declare const undo: Command; /** ProseMirror command: redo this peer's last undone edit. */ export declare const redo: Command; export declare function canUndo(state: EditorState): boolean; export declare function canRedo(state: EditorState): boolean; /** * The bindings `prosemirror-history` would have owned. * * Pass to `keymap()` from `prosemirror-keymap`; this package does not depend on * it, so the object is plain. */ export declare const loroUndoKeymap: Record; //# sourceMappingURL=undo.d.ts.map