Suggests users to @mention as the user types in TextEditor. It keeps the state of the suggestions, fetched from GET /api/users?q=, and TextEditor renders them in a MentionDropdown.

Functions

f
useMentionAutocomplete(
replace: (
start: number,
end: number,
text: string,
word: boolean
) => void
,
everyone?: boolean
): UseMentionAutocompleteResult

Returns the suggestions' state and the functions that drive them. A pick goes through replace, TextEditor's function that puts the text over [start, end) of the textarea's value, followed by a space when word is set. With everyone, which the chat's composer sets for a role with chat:everyone, @everyone is offered too.

Interfaces

I
UseMentionAutocompleteResult

Returned by useMentionAutocomplete to TextEditor.

Type Aliases