LeaVerou / awesomplete

Ultra lightweight, usable, beautiful autocomplete with zero dependencies.
http://leaverou.github.io/awesomplete/
MIT License
6.96k stars 611 forks source link

Autocomplete multiple words? #14184

Closed nodiscc closed 9 years ago

nodiscc commented 9 years ago

Hi, thanks for your work on this. I was considering using awesomplete in https://github.com/shaarli/Shaarli, to provide autocompletion for a link "tagging" field. (We use JqueryUI for this and would like to get rid of it.)

autcomplete

As shown on the example, a link can have multiple tags - we suggest already-existing tags on user input; every time the separating character (space) is entered, we start suggesting again for the next word. Currently awesomplete olny enables suggestions for the first word entered. How can I make awesomplete show suggestions for each word in the text input box?

LeaVerou commented 9 years ago

This is related to #14491 but different, in the sense that the tags are all in the input. It’s probably doable via the API in a similar way as the email domain autocomplete. I would love to work on this when I get some time.

LeaVerou commented 9 years ago

Actually, I thought it was too interesting and I quickly coded up an example. Check out http://leaverou.github.io/awesomplete/#multiple-values It’s not perfect, but hopefully it’s a start :)

nodiscc commented 9 years ago

@LeaVerou Thanks for the quick reply, this is actually very close to what we need! We'll try to implement it as a prototype, as far as I can see it only misses 1) Using space as the separator but I guess this is a 1-char change in the example code; 2) being able to use TAB (instead of click) to trigger autocompletion for the current word, while the text area retains focus.

If you have ideas on how to achieve this they're very welcome. Thanks again!

nodiscc commented 9 years ago

By the way the #multiple-values link doesn't point to the right header. The closer I could find is https://leaverou.github.io/awesomplete/#advanced-examples

nodiscc commented 9 years ago

I think this can be closed, it works as expected (changing separator character is another issue, I'll have a look). Thx