0
文全体に対してtextcompleteを使用しようとしています。私は別の正規表現をたくさん試しましたが、 ".textcomplete"はまだ文の最初の単語を検索します。.textcompleteを使用して文全体のテキストを完成
誰か良いですか?
$('#search').textcomplete([{
words: array,
match: /\b(\w{1,})$/,
search: function (term, callback) {
term = term.toLowerCase();
callback($.map(array, function (word) {
return word.toLowerCase().indexOf(term) === 0 ? word : null;
}));
},
select: function (value, strategy) {
this.adapter.select(value, strategy);
this.fire('change').fire('textComplete:select', value, strategy);
this.adapter.focus();
},
index: 1,
replace: function (word) {
return word;
},
}], {
onKeydown: function (e, commands) {
if (e.ctrlKey && e.keyCode === 74) { // CTRL-Enter
return commands.KEY_ENTER;
}
}
});
Autocomplete stops when pressing space