Make Hashtag autocomplete case-insensitive
This commit is contained in:
parent
a5bb8f4e7d
commit
84b4ff58b6
|
@ -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 a new issue