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.
Properties
Section titled “Properties”replace
Section titled “replace”readonly replace: object;The replacement text, with the position of the selection inside it.
selection?
Section titled “selection?”readonly selection?: object;Where the selection goes in the new text. When start and end are the same, it is the caret.
selection.end
Section titled “selection.end”end: number;The position at which the selection ends.
selection.start
Section titled “selection.start”start: number;The position at which the selection begins.
readonly text: string;The new text of the field.
