question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MentionSuggestions whitespace Regex filter issue

See original GitHub issue

suppose you have a suggestion list like that

[
{ name: 'call 1' , value:1 },
{ name: 'call 2' , value:2 },
{ name: 'call 3' , value:3 }
]

if you type ‘@call 3’ at the editor it will not narrow the search to item call 3 , because the whitespace breaks it . instead it will give you all of them.

i’ve noticed also a sorting issue with suggestions when you search for something that contains A for example the suggestions that begins with A needs to be at the top of the list which is not the case. instead it gives you the the natural order of your current suggestions list.

now how i can modify the regex and the mentionSuggestionsStrategy to do so ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nikgrafcommented, Nov 24, 2016

@Revln9 there even was a PR for whitespace support at some point. Unfortunately it’s even more complicated as you need to limit the amount of spaces for the decorators. Even then you need to make sure there are no overlapping decorators.

In the end I decided to not accept it and recommend to publish it as a separate plugin. The only way to get this in properly would be a re-write of the plugin without leveraging decorators.

0reactions
nikgrafcommented, Dec 9, 2016

@Revln9 @luisrudge To tackle this issue, I believe the plugin has to be fundamentally different. Instead of using decorators you could run a regex on every selection change and then show an autocomplete dropdown. The code would be way easier and I believe this could eventually even replace the mention plugin.

If any of you would write autocomplete plugin, that would be awesome …

Read more comments on GitHub >

github_iconTop Results From Across the Web

z4o4z/draft-js-mention-plugin/CHANGELOG.md - UNPKG
30, - Force update regex's `lastIndex` to avoid infinite loop. 31, - Fixed replace issue while `mentionTrigger` is empty.
Read more >
Mention - DraftJS Plugins - High quality plugins with great UX
The function returns the filter list based on substring matches. import { defaultSuggestionsFilter } from '@draft-js-plugins/mention' ...
Read more >
Regex Text Filter on Multiple Whitespace not working - GitLab
Filtering lines of text with multiple whitespaces, followed by any characters does not seem to work. ie. I do believe that \s\s\s\s works,...
Read more >
RegEx for no whitespace at the beginning and end
The unicode topic is important. I read that with Javascript is no so effective, but it is with PCRE. I have this code:...
Read more >
Use regular expressions in filters and automated rules
Regular expression syntax ; \s, Space character, \s+.* matches one or more whitespace followed by zero or more characters ; \d, Digit, \d65\d...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found