client/search: correct case in autocompleted tags

This commit is contained in:
rr- 2016-09-29 22:54:51 +02:00
parent 977cc47966
commit 8f275206af
1 changed files with 2 additions and 5 deletions

View File

@ -6,7 +6,6 @@ const AutoCompleteControl = require('./auto_complete_control.js');
class TagAutoCompleteControl extends AutoCompleteControl { class TagAutoCompleteControl extends AutoCompleteControl {
constructor(input, options) { constructor(input, options) {
const caseSensitive = false;
const minLengthForPartialSearch = 3; const minLengthForPartialSearch = 3;
options = Object.assign({ options = Object.assign({
@ -14,9 +13,7 @@ class TagAutoCompleteControl extends AutoCompleteControl {
}, options); }, options);
options.getMatches = text => { options.getMatches = text => {
const transform = caseSensitive ? const transform = x => x.toLowerCase();
x => x :
x => x.toLowerCase();
const match = text.length < minLengthForPartialSearch ? const match = text.length < minLengthForPartialSearch ?
(a, b) => a.startsWith(b) : (a, b) => a.startsWith(b) :
(a, b) => a.includes(b); (a, b) => a.includes(b);
@ -40,7 +37,7 @@ class TagAutoCompleteControl extends AutoCompleteControl {
<span class="${cssName}"> <span class="${cssName}">
${origName} (${usages}) ${origName} (${usages})
</span>`, </span>`,
value: kv[0], value: origName,
}; };
}); });
}; };