/*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net */ /** * [[include:modules/history/README.md]] * @packageDocumentation * @module modules/history */ import type { IDestructible, IHistory, IJodit, ISnapshot, SnapshotType } from "../../types/index"; import { ViewComponent } from "../../core/component/view-component"; import { Snapshot } from "./snapshot"; import { Stack } from "./stack"; declare module 'jodit/config' { interface Config { history: { enable: boolean; /** * Limit of history length */ maxHistoryLength: number; /** * How long a step stays open after its first change, in * milliseconds. The changes made in that time are undone together. */ timeout: number; }; } } /** * The module monitors the status of the editor and creates / deletes the required number of Undo / Redo shots . */ export declare class History extends ViewComponent implements IHistory { /** @override */ className(): string; /** * Return state of the WYSIWYG editor to step back */ redo(): void; canRedo(): boolean; /** * Return the state of the WYSIWYG editor to step forward */ undo(): void; canUndo(): boolean; clear(): void; get length(): number; private __startValue; protected get startValue(): SnapshotType; protected set startValue(value: SnapshotType); private readonly __stack; snapshot: ISnapshot & IDestructible; constructor(editor: IJodit, stack?: Stack, snapshot?: Snapshot); private updateTick; /** * A step is open: changes have come in that are not in the stack yet */ private __hasPendingChanges; /** * Records the open step `history.timeout` after its first change */ private __timer; /** * Update change counter * @internal */ protected __upTick(): void; /** * Push new command in stack on some changes. The first change opens a * step, and later ones join it until `history.timeout` has passed, * however close together they come. */ private onChange; /** * Push the open step's changes now */ private __processPendingChanges; /** * @internal */ protected __processChanges(): void; /** * Update history stack */ private updateStack; private fireChangeStack; destruct(): void; }