missive / emoji-mart

πŸͺ One component to pick them all
https://missiveapp.com/open/emoji-mart
MIT License
8.67k stars 835 forks source link

Search should allow with or without colons #363

Open rmccue opened 5 years ago

rmccue commented 5 years ago

We're using the emojiIndex.search function outside of Emoji Mart to provide autocompletions in a textarea. These are formatted similar to most other autocompletions, with the trigger character being a colon; e.g. :thu -> :thumbsup:

As part of this, we'd like to ensure we correctly autocomplete emoticon-style emoji; e.g. :). The readme explicitly notes Emoji Mart is the "only emoji picker that returns emojis when searching for emoticons".

However, right now, it's painful to use the search for this, as emoticons include the : and emoji names do not. This means when I begin typing :thu, we have to search the index for both :thu (to catch emoticons) and thu (to catch regular emoji), then combine those results.

Here's an example, where I type :s, which could complete to :confounded: (πŸ˜–) or be the beginning of :speaker: (πŸ”ˆ) or another emoji:

Without colon With colon Combined
Screen Shot 2019-09-13 at 11 05 26 Screen Shot 2019-09-13 at 11 05 08 Screen Shot 2019-09-13 at 11 07 13

Suggested Solution

search should allow searching with the preceding colon. :s should trigger a search through the emoji names for both s and :s.

Alternatively, the short names could be stored with colons to simplify the search algorithm, but that's a fairly major change I imagine.

nolanlawson commented 4 years ago

Thanks for the detailed writeup! I'm a bit confused about what behavior, though, you're looking for. Maybe a code snippet would help explain?

skerrepy commented 4 years ago

@nolanlawson what he tried to say is can you add a way where a user can find an emoji this way :"emoji name": check discord/github emoji trigger basically ":" will trigger an event and will end that event with ":" like this πŸ˜„ ":smile:"