Tells the editor's autocompletes when the caret is inside code, where they stay closed, and the chat when a message is only emoji, which it shows large.
f
insideCode(textBefore: string): boolean
Checks whether the caret at the end of textBefore sits inside Markdown
code, an open ``` fence or an unclosed span on the current line. The
mention and emoji autocompletes stay closed there, since `@bob` and `:smile`
are literal text in code.
f
isEmojiOnly(): boolean
text: string,
max?: number
Checks whether text is nothing but max emoji at most, which the chat
shows large, as in "🎉" or "👍👍". Emoji are counted as graphemes, so a
family or a flag counts once.
Usage
import * as mod from "src/utils/editor/text.ts";