jcubic/tagger

Completion option and new async API

jcubic opened this issue · 9 comments

Add option for async completion, best is function that should return array of strings or promise.

@jcubic is the completion function functional ?

Because for the moment I had to code internally to add this feature (line 117):

this._new_input_tag.setAttribute("list", "completeTags");
this._new_data_list = document.createElement('datalist');
this._new_data_list.id = "completeTags";
for(let opt in this._settings.completion.list) {
    if(this._settings.completion.list.hasOwnProperty(opt)) {
        let option = document.createElement('option');
        option.value = this._settings.completion.list[opt];
        this._new_data_list.appendChild(option);
    }
}
this.tags_from_input();
li.appendChild(this._new_input_tag);
li.appendChild(this._new_data_list);

And I did not find anything in the documentation how to implement it.

It seems that it's not even working, I've didn't finish that feature. Will need to add so the option is working.

first version of completion, it work on tab key, but it will work with delay as per API. Using tab is not very accessible because it remove move to next input feature that will be used by person with just keyboard.

Just found about datalist, will add it later like in your code.

Using tab is not very accessible because it remove move to next input feature that will be used by person with just keyboard.

Maybe use something else like Ctrl + space ?

It now work like this, if completion.list is array it's added at the beginning, if it's function it's added on input change, and if input length is greater or equal to completion.min_length tagger show the list, this can be forced by using CTRL+Space.

Working great 👍 Thanks.

Are you going to publish it on npm soon?

yes, will publish, I think that everything for 0.2.0 is there.

Just published version 0.2.0