react-mentions icon indicating copy to clipboard operation
react-mentions copied to clipboard

Mention user's email using "@" as trigger (trigger character in suggestions list)

Open kylechartio opened this issue 4 years ago • 2 comments

Steps to reproduce:

  1. Let the list of suggestions just be emails
  2. Use "@" as your trigger
  3. Start typing the email
  4. 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?

kylechartio avatar Apr 23 '20 16:04 kylechartio

Should be doable with custom regexp.

jfschwarz avatar May 22 '20 07:05 jfschwarz

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.

liampcollins avatar Aug 13 '21 15:08 liampcollins