LeaVerou / awesomplete

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

Highlighting word with accent #17187

Open vjmartins opened 5 years ago

vjmartins commented 5 years ago

Hi..

Im trying to search accents words with a filter and work fine to me..But i need some help to highlight..

var comboplete = new Awesomplete("dstAutoComplete", { minChars: 2, filter: function(text, input) { return Awesomplete.FILTER_STARTSWITH(text.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), input.match(/[^,]*$/)[0]); }, });

In this example word So and must be highlight.

Teste Autocomplete

Sorry my english.

caneco commented 4 years ago

Trying to solve this exact problem…

caneco commented 4 years ago

Solved it… 💪

@LeaVerou how it's the proper/easy way to add a awesomplete-plugin?

LukaszJaro commented 4 years ago

I just noticed this issue as well on a bilingual site I'm developing, for example the highlighting only reaches the 't' in sauté

After you type e, the result vanishes!

@caneco can you share the fix?

@LeaVerou this appears to be a bug/possible regression?

I noticed accent highlighting does work if input and value characters match exactly. Accent character cannot be searched if value is also not accent, and vice versa. There's probably multiple ways to handle this.

LukaszJaro commented 4 years ago

@vjmartins your solution doesn't work with french keyboards, if someone actually types with accents, no results will display.

LeaVerou commented 4 years ago

@LeaVerou how it's the proper/easy way to add a awesomplete-plugin?

There is no specific way right now, but I would love to add a directory of plugins!!