react-mentions
react-mentions copied to clipboard
Mention user's email using "@" as trigger (trigger character in suggestions list)
Steps to reproduce:
- Let the list of suggestions just be emails
- Use "@" as your trigger
- Start typing the email
- Once you get to the "@" in the email, the suggestions list closes
Expected behaviour: The suggestions list should stay open.
Observed behaviour: The suggestions list closes
I searched the issues and even experimented with some regexp triggers but couldn't find a way to support this use case. I don't want it to close the suggestions list just because I typed the character. Is it possible to have the trigger character be used while searching?
Should be doable with custom regexp.
try trigger={/(?:^|\s)(@([^\s]*))$/}
will restricth the @
trigger to only fire when it sees @
without something before it, so won't be triggered with @
in the middle of an email so won't break your suggestions.