webscopeio / react-textarea-autocomplete

📝 React component implements configurable GitHub's like textarea autocomplete.
MIT License
454 stars 80 forks source link

Whitespace in token #58

Closed corbt closed 6 years ago

corbt commented 6 years ago

Hey there! Thanks so much for this library. I'm trying to use this to implement @ mentions to mention other people. However, since our community works on full names instead of usernames, there is generally a whitespace in the name in question; eg. "Bob Smith". Is there a way I can configure this library to accept one whitespace and pass it on to my dataProvider? Thanks!

jukben commented 6 years ago

Hi @corbt! Great issue request. Unfortunately, currently, it's not possible. But I like this use case, I'm going to jump into it and I will try to figure out some solution. Stay tuned! 🙏

jukben commented 6 years ago

Hey @corbt! See the attached PR – this is the best what I've been to come with. Would you be so kind and could you give it a shot before I will publish it as a stable? 🙏

Checkout the repo yarn and yarn link and then in you project yarn link @webscopeio/react-textarea-autocomplete should be enough.

Also check out the updated readme ideally all you have to do is just add allowWhitespace: true under your @ trigger. 💪

I hope it will work and it solves your problem.

corbt commented 6 years ago

Wow, thanks for the quick work!

Unfortunately I'm running into an issue with testing. After cloning locally and running both yarn link commands I'm getting an error Module not found: Error: Can't resolve '@webscopeio/react-textarea-autocomplete'. Not sure what's going on with that. :(

jukben commented 6 years ago

In the cloned repo you should run yarn link and in the target project (in your project I believe) you should be able to run yarn link @webscopeio/react-textarea-autocomplete (or something like this, see the output of the previous command).

Although you can just clone and install the repo, run yarn dev and test it in the "example". 👍

Let me know.

corbt commented 6 years ago

FYI I'm on vacation for the next 3 weeks, so I'll have to look at this once I get back. :(

jukben commented 6 years ago

@corbt no problem I can wait as soon you are the only one who has requested this feature is crucial to meet your needs. Get back to me after your vacation and enjoy! 🌴

jukben commented 6 years ago

It's in master, once you get time to test it out @corbt fell free to get to me with a feedback.