abinavseelan / react-input-trigger

React component for handling character triggers inside textareas and input fields. 🐼
MIT License
88 stars 20 forks source link

Will it support Multiple KeyCode Trigger? #20

Open ganeshmani opened 4 years ago

ganeshmani commented 4 years ago

I am looking for a feature like slack where user can trigger different action through different input ("/" for command actions and "@" for user mentions). will this library support that?

TonisPiip commented 4 years ago

I did, using react, however there were several stumbling blocks that I had to get over. Mainly that I had to nest the triggers in order to get it multiple triggers to work, ie # for tickets and @ for users, and in doing that I had to create a fork to target the correct input element. Also as I am using the Quill editor I had to fork it to have it be able to read and write to the editor without breaking.

In short, yes it;s possible, but unless they've fixed some of the issues I had, you might have to fork it or make some tweaks.

One major downside I had was that it doesn't naturally close the trigger, IE if you just want to put # then later put a link to #12 it fails to catch the second triggering as you have to end the triggering in order for it to catch a another. I was able to work around that by ending the triggers on [return] and perhaps also on a trigger char if there's no list of suggestions.

In short. yes, but it's not really an out of the box system IMO. But it does work for that use.

ganeshmani commented 4 years ago

Thanks.. i found this repo which kind of solves the problem for me. react-mentions