@launchmenu/core
Version:
An environment for visual keyboard controlled applets
32 lines • 1.76 kB
TypeScript
import { IIOContext } from "../../../../context/_types/IIOContext";
import { IKeyEventListener } from "../../../../keyHandler/_types/IKeyEventListener";
import { UndoRedoFacility } from "../../../../undoRedo/UndoRedoFacility";
import { ICommand } from "../../../../undoRedo/_types/ICommand";
import { ITextField } from "../../../_types/ITextField";
import { ITextEditCommand } from "../../commands/_types/ITextEditCommand";
import { ITextEditTarget } from "../../_types/ITextEditTarget";
/**
* Creates a key handler for undoable key events, according to the specified createHandler callback.
* This function takes care of the command execution and command merging based on the user's preferences
* @param textField The text field to be altered
* @param context The context to obtain the user's settings from
* @param createHandler The function to construct the actual keyhandler
* @param options Any additional options for customization
* @returns A key handler
*/
export declare function createUndoableTextFieldKeyHandler<T extends IKeyEventListener>(textField: ITextField, context: IIOContext, createHandler: (data: {
undoableTextField: ITextEditTarget;
onEditCommand: (command: ICommand) => void;
handleUndoRedoInput?: IKeyEventListener;
}) => T, options?: {
/** The undo redo facility to execute the commands in */
undoRedoFacility?: UndoRedoFacility;
}): T;
/**
* Checks whether two given commands should merge
* @param prevCommand Command a
* @param command Command b
* @returns Whether the commands should merge
*/
export declare function shouldTextCommandsMerge(prevCommand: ITextEditCommand, command: ITextEditCommand): boolean;
//# sourceMappingURL=createUndoableTextFieldKeyHandler.d.ts.map