Merge pull request #4704 from MrPetovan/bug/4608-hashtag-autocomplete-ci
Make hashtag autocomplete case-insensitivepull/4711/head
commit
4326fa4e19
|
@ -31,7 +31,7 @@ class Hashtag extends BaseModule
|
||||||
intval(TERM_HASHTAG)
|
intval(TERM_HASHTAG)
|
||||||
);
|
);
|
||||||
while ($tag = dba::fetch($taglist)) {
|
while ($tag = dba::fetch($taglist)) {
|
||||||
$result[] = ['text' => strtolower($tag['term'])];
|
$result[] = ['text' => $tag['term']];
|
||||||
}
|
}
|
||||||
dba::close($taglist);
|
dba::close($taglist);
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,15 @@ function string2bb(element) {
|
||||||
tags = {
|
tags = {
|
||||||
match: /(^|\s)(\#)([^ \n]{2,})$/,
|
match: /(^|\s)(\#)([^ \n]{2,})$/,
|
||||||
index: 3,
|
index: 3,
|
||||||
search: function(term, callback) { $.getJSON(baseurl + '/hashtag/' + '?f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); },
|
search: function(term, callback) {
|
||||||
|
$.getJSON(baseurl + '/hashtag/' + '?f=&t=' + term)
|
||||||
|
.done(function(data) {
|
||||||
|
callback($.map(data, function(entry) {
|
||||||
|
// .toLowerCase() enables case-insensitive search
|
||||||
|
return entry.text.toLowerCase().indexOf(term.toLowerCase()) === 0 ? entry : null;
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
},
|
||||||
replace: function(item) { return "$1$2" + item.text + ' '; },
|
replace: function(item) { return "$1$2" + item.text + ' '; },
|
||||||
template: tag_format
|
template: tag_format
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue