Encapsulates the message entry field tied to the currently selected conversation.
Gets the current content of the message field.
MessageField.setText(text: string): void
Sets the message entry field to text. Useful if you want to guide your user with message suggestions.
|text Required||The text to be displayed in the message entry field|
MessageField.getText(text: string): void
Types the given
text into the message field.
text wherever the cursor currently is.
This method may be useful for various bot/simulation scenarios. Additionally, it lets you make it so that any regular keypress lets the user start typing into the message field, even if it is not focused.
To do that, capture the keypress using a regular window event listener, ensure that
the user isn't typing into a different input, and then call this method to type the
key, followed by
focus. Note that TalkJS already does this out-of-the box
when the chat UI iframe has focus and ChatboxOptions.captureKeyboardEvents is off.
|text Required||The text to be inserted in the message entry field|
MessageField.setVisible(visible: boolean | ConversationPredicate): void
Sets the visibility of the Message Field to a given value or to a certain predicate.
|visible Required||A boolean or predicate that outlines the circumstances the message field should be hidden|
Focuses the message entry field.