Closed audiolion closed 6 years ago
Hi! 👋 Thanks for the bug report, could you please create repro demo (you can use this pen as a start https://codepen.io/jukben/pen/bYZqvR)? Ideally, with described actual and expected behavior. I'm not sure if I understood it correctly, but I haven't been able to reproduce it.
@jukben oh man, awesome codepen starter, here is a repro: https://codepen.io/yankasuto/pen/WgyObR
Try inserting two autocompletes in a row and you will see it happen
My apologies, you have to have "allowWhitespace: true" for the bug to occur.
Great! I see, that's actually a feature because allowWhitespace: true
, why do you event need it?
allowWhitespace
is there for a reason if your tokens are with a space, so you want to replace all the occurrences no matter whitespaces.
Ok I made a gif of using the codepen, you are saying this is the intended behavior:
If it is then you can close this issue. To me it makes it so you can never have more than one autocomplete in the same text area with allowWhitespace: true
. E.g.
Hello [contact first name], you will receive a letter addressed to [contact first name] [contact last name]
^ this scenario wouldn't work with the above codepen.
Oh, I see, that's definitely buggy. I mean, the best you can do is to avoid allowWhitespace
at all, but since it's there I will do my best to fix it.
This looks fine, don't you say?
Yeah I actually am avoiding allowWhitespace
currently. That fix looks good!
Hello 👋 ,
If you have a trigger like
@
which opens up a list of users to select from, and the output is@audiolion
, if you try to do another@
in the same textarea and select@webscopeio
, the selection will replace the first@audiolion
with@webscopeio
instead of inserting the new autocomplete.Seems fairly obvious that it looks for the first occurrence of the trigger in the document and replaces instead of maintaining the current selection of where the trigger occurred and replacing it there.