import type { HotInstance } from '../../core/types'; import { BasePlugin } from '../base'; export interface UndoRedoAction { actionType: string; [key: string]: unknown; } export declare const PLUGIN_KEY = "undoRedo"; export declare const PLUGIN_PRIORITY = 1000; /** * @description * Handsontable UndoRedo plugin allows to undo and redo certain actions done in the table. * * __Note__, that not all actions are currently undo-able. The UndoRedo plugin is enabled by default. * @example * ```js * undo: true * ``` * @class UndoRedo * @plugin UndoRedo */ export declare class UndoRedo extends BasePlugin { #private; /** * Returns the plugin key used to identify this plugin in Handsontable settings. */ static get PLUGIN_KEY(): string; /** * Returns the priority order used to determine the order in which plugins are initialized. */ static get PLUGIN_PRIORITY(): number; /** * Returns whether the plugin handles its own settings keys without a dedicated key list. */ static get SETTING_KEYS(): true; /** * The list of registered action do undo. * * @private * @type {Array} */ doneActions: unknown[]; /** * The list of registered action do redo. * * @private * @type {Array} */ undoneActions: unknown[]; /** * The flag that determines if new actions should be ignored. * * @private * @type {boolean} */ ignoreNewActions: boolean; /** * Initializes the plugin and registers all built-in undo/redo action handlers for the given Handsontable instance. */ constructor(hotInstance: HotInstance); /** * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit} * hook and if it returns `true` then the {@link UndoRedo#enablePlugin} method is called. * * @returns {boolean} */ isEnabled(): boolean; /** * Enables the plugin functionality for this Handsontable instance. */ enablePlugin(): void; /** * Disables the plugin functionality for this Handsontable instance. */ disablePlugin(): void; /** * Registers shortcuts responsible for performing undo/redo. * * @private */ registerShortcuts(): void; /** * Unregister shortcuts responsible for performing undo/redo. * * @private */ unregisterShortcuts(): void; /** * Stash information about performed actions. * * @fires Hooks#beforeUndoStackChange * @fires Hooks#afterUndoStackChange * @fires Hooks#beforeRedoStackChange * @fires Hooks#afterRedoStackChange * @param {Function} wrappedAction The action descriptor wrapped in a closure. * @param {string} [source] Source of the action. It is defined just for more general actions (not related to plugins). */ done(wrappedAction: Function, source?: string): void; /** * Undo the last action performed to the table. * * @fires Hooks#beforeUndoStackChange * @fires Hooks#afterUndoStackChange * @fires Hooks#beforeRedoStackChange * @fires Hooks#afterRedoStackChange * @fires Hooks#beforeUndo * @fires Hooks#afterUndo */ undo(): void; /** * Redo the previous action performed to the table (used to reverse an undo). * * @fires Hooks#beforeUndoStackChange * @fires Hooks#afterUndoStackChange * @fires Hooks#beforeRedoStackChange * @fires Hooks#afterRedoStackChange * @fires Hooks#beforeRedo * @fires Hooks#afterRedo */ redo(): void; /** * Checks if undo action is available. * * @returns {boolean} Return `true` if undo can be performed, `false` otherwise. */ isUndoAvailable(): boolean; /** * Checks if redo action is available. * * @returns {boolean} Return `true` if redo can be performed, `false` otherwise. */ isRedoAvailable(): boolean; /** * Clears undo and redo history. */ clear(): void; /** * Destroys the plugin instance. */ destroy(): void; }