Skip to content

Replace

The object that a shouldChangeText hook returns to put another text in place of the text that is being typed. The other possible answers of such a hook are allow() and veto(code, message).

A plugin builds this object with replace(text, selection?), and the documentation of that function contains an example.

readonly replace: object;

The replacement text, with the position of the selection inside it.

readonly selection?: object;

Where the selection goes in the new text. When start and end are the same, it is the caret.

end: number;

The position at which the selection ends.

start: number;

The position at which the selection begins.

readonly text: string;

The new text of the field.