@ckeditor/ckeditor5-undo
Version:
Undo feature for CKEditor 5.
28 lines (27 loc) • 1.36 kB
TypeScript
/**
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/
/**
* @module undo/redocommand
*/
import BaseCommand from './basecommand.js';
/**
* The redo command stores {@link module:engine/model/batch~Batch batches} that were used to undo a batch by
* {@link module:undo/undocommand~UndoCommand}. It is able to redo a previously undone batch by reversing the undoing
* batches created by `UndoCommand`. The reversed batch is transformed by all the batches from
* {@link module:engine/model/document~Document#history history} that happened after the reversed undo batch.
*
* The redo command also takes care of restoring the {@link module:engine/model/document~Document#selection document selection}.
*/
export default class RedoCommand extends BaseCommand {
/**
* Executes the command. This method reverts the last {@link module:engine/model/batch~Batch batch} added to
* the command's stack, applies the reverted and transformed version on the
* {@link module:engine/model/document~Document document} and removes the batch from the stack.
* Then, it restores the {@link module:engine/model/document~Document#selection document selection}.
*
* @fires execute
*/
execute(): void;
}