MentionSuggestions whitespace Regex filter issue
See original GitHub issuesuppose 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:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
@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 …