Skip to content

TextChange

What a shouldChangeText hook receives: a modification of the text of a field that is about to be made, and the text that it would produce.

ctx.editing.shouldChangeText({ topics: ['row.title'] }, change => {
// `change.text` is the current text, and `change.resulting` is the text after the modification
return change.resulting.length > 200 ? veto('too-long', 'A title cannot exceed 200 characters') : allow();
});
readonly caret: number;

The position of the caret once the modification is made: after the text that was typed, or where an earlier hook said that it goes.


readonly field: FieldRef;

The field that is being modified.


readonly pending: readonly Intent[];

The follow-ups that earlier hooks asked for, such as a state, a tag or a priority, which show what the row is about to become.


readonly range: Range;

The part of the current text that the modification replaces.


readonly replacement: string;

The text that takes the place of that part.


readonly resulting: string;

The text of the field after the modification.


readonly text: string;

The text of the field before the modification.