(position?: number[])
| 408 | }; |
| 409 | |
| 410 | const checkEmoji = (position?: number[]) => { |
| 411 | const current = [textarea.selectionStart, textarea.selectionEnd]; |
| 412 | const selection = position ?? current; |
| 413 | const [word] = getCloseWord(textarea, selection); |
| 414 | const colon = word.substring(1); |
| 415 | const isValid = word.charAt(0) === ':'; |
| 416 | |
| 417 | if (!isValid) { |
| 418 | return updateEmojiQuery(undefined); |
| 419 | } |
| 420 | |
| 421 | if (isNullOrUndefined(emojiQuery)) { |
| 422 | return updateEmojiQuery(colon ?? ''); |
| 423 | } |
| 424 | |
| 425 | return updateEmojiQuery(colon); |
| 426 | }; |
| 427 | |
| 428 | const onKeyUp: KeyboardEventHandler<HTMLTextAreaElement> = (e) => { |
| 429 | const pressed = e.key as ArrowKey; |
no test coverage detected