json-joy
Version:
Collection of libraries for building collaborative editing apps.
27 lines (26 loc) • 993 B
TypeScript
import type { UndoManager, UndoItem } from '../../../types';
import type { UiLifeCycles } from '../../types';
/**
* A DOM-based undo manager. Integrates with native undo/redo functionality of
* the browser. Supports user Ctrl+Z and Ctrl+Shift+Z shortcuts and application
* context menu undo/redo events.
*/
export declare class WebUndo implements UndoManager, UiLifeCycles {
/** Whether we are in a process of pushing a new undo item. */
private _push;
/** The DOM element, which keeps text content for native undo/redo integration. */
protected el: HTMLElement;
/** Undo stack. */
uStack: UndoItem[];
/** Redo stack. */
rStack: UndoItem[];
protected _undo(): void;
protected _redo(): void;
push<U, R>(undo: UndoItem<U, R>): void;
undo(): void;
redo(): void;
/** -------------------------------------------------- {@link UiLifeCycles} */
start(): () => void;
readonly onFocus: () => void;
readonly onInput: () => void;
}