Only match emoji autocomplete after two characters

This commit is contained in:
Max Leiter 2017-08-22 11:04:38 +03:00 committed by Pavel Djundik
parent a99ea14dc0
commit 64ea29f46d

View File

@ -48,10 +48,12 @@ $(function() {
const emojiSearchTerms = Object.keys(emojiMap); const emojiSearchTerms = Object.keys(emojiMap);
const emojiStrategy = { const emojiStrategy = {
id: "emoji", id: "emoji",
match: /\B:([-+\w]*):?$/, match: /\B:([-+\w:?]{2,}):?$/,
search(term, callback) { search(term, callback) {
const results = fuzzy.filter( const results = fuzzy.filter(
term, // Trim colon from the matched term,
// as we are unable to get a clean string from match regex
term.replace(/:$/, ""),
emojiSearchTerms, emojiSearchTerms,
{ {
pre: "<b>", pre: "<b>",