Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default markup regex breaks when entering @[ #744

Open
JefHellemansBlockbax opened this issue May 6, 2024 · 0 comments
Open

Default markup regex breaks when entering @[ #744

JefHellemansBlockbax opened this issue May 6, 2024 · 0 comments

Comments

@JefHellemansBlockbax
Copy link

Comments:
This is probably not something that is going to happen frequently, but I came across it while debugging our own implementation which has a simpler markup ({{__id__:__display__}}). For that markup, with {{ as trigger, the default regex breaks whenever another mention comes after it, even when just typing the trigger. Turns out this behaviour also occurs for the default markup and regex, although it's less obvious.

Steps to reproduce:

  1. Go to https://react-mentions.vercel.app/.
  2. In the very first input box, put your cursor at the beginning (before Hi John Doe,).
  3. Type @, the search box appears.
  4. Type [.

Expected behaviour:
The results in the search box are updated. Likely nothing will match, but that should be fine.

Observed behaviour:
The new mention gets combined with the one that comes after it (in this case John Doe), and the search box disappears. Any text that was in between is now part of the mention as well.

Workaround:
Use a different regex. I haven't thought about a solution for the default one, but will be writing one for our own implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant