diff --git a/src/emojipicker.tsx b/src/emojipicker.tsx index 7861b96..0ee8c97 100644 --- a/src/emojipicker.tsx +++ b/src/emojipicker.tsx @@ -9,45 +9,41 @@ const denoCore: DenoCore = Deno[Deno.internal].core; export default function EmojiPicker(props: { text: string }): ReactNode | undefined { const text = props.text; - try { - if (text.length < 3) { - return undefined - }; - - const emoji = UnicodeEmoji.getEmojis().find(emoji => emoji.keywords.includes(text)); - if (!emoji) { - return undefined - }; - - return ( - - { - console.log(emoji.emoji) - await Clipboard.writeText(emoji.emoji); - showHud(`${emoji.emoji} copied to clipboard`); - }} - /> - - } - > - - - {text} - - - - - - {emoji.emoji} - - - - ) - } catch (e) { + if (text.length < 3) { return undefined }; + + const emoji = UnicodeEmoji.getEmojis().find(emoji => emoji.keywords.includes(text)); + if (!emoji) { + return undefined + }; + + return ( + + { + console.log(emoji.emoji) + await Clipboard.writeText(emoji.emoji); + showHud(`${emoji.emoji} copied to clipboard`); + }} + /> + + } + > + + + {text} + + + + + + {emoji.emoji} + + + + ); };