MCPcopy Create free account
hub / github.com/dailydotdev/apps / checkEmoji

Function checkEmoji

packages/shared/src/hooks/input/useMarkdownInput.ts:410–426  ·  view source on GitHub ↗
(position?: number[])

Source from the content-addressed store, hash-verified

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;

Callers 3

onInputClickFunction · 0.85
onKeyUpFunction · 0.85
onInputFunction · 0.85

Calls 3

getCloseWordFunction · 0.90
isNullOrUndefinedFunction · 0.90
updateEmojiQueryFunction · 0.85

Tested by

no test coverage detected