UNPKG

@launchmenu/core

Version:

An environment for visual keyboard controlled applets

43 lines 1.57 kB
import { Field, IDataHook } from "model-react"; import { ITextSelection } from "./_types/ITextSelection"; import { ITextField } from "./_types/ITextField"; /** * A mutable field to contain a text input as well as the selected range */ export declare class TextField implements ITextField { protected selection: Field<{ start: number; end: number; }>; protected text: Field<string>; /** * Creates a new TextField that stores text and selection data * @param text The initial text to store * @param selection The selected text * @param keepCarriageReturn Whether to keep the carriage returns, defaults to false, keeping them may cause bugs when using the EditorField react component */ constructor(text?: string, selection?: ITextSelection, keepCarriageReturn?: boolean); /** * Sets the value of the text field * @param text The new text */ set(text: string): void; /** * Retrieves the value of the text field * @param hook The hook to subscribe to changes * @returns The current text */ get(hook?: IDataHook): string; /** * Sets the selection range * @param selection The new selection */ setSelection(selection: ITextSelection): void; /** * Retrieves the selected range (or cursor if start==end) * @param hook The hook to subscribe to changes * @returns The selected range */ getSelection(hook?: IDataHook): ITextSelection; } //# sourceMappingURL=TextField.d.ts.map