Require three characters to match :100, :1234 to avoid catching times #1148

This commit is contained in:
Ben Gotow 2018-11-03 19:34:42 -07:00
parent fc32702fb8
commit efcbf996d6

View file

@ -252,11 +252,16 @@ function onKeyUp(event, change, editor) {
}
let suggestions = [];
let picked = emoji.data.get('picked');
if (typed.length >= 3) {
suggestions = getEmojiSuggestions(typed.replace(':', ''));
const typedEmoji = typed.replace(':', '');
const isNumeric = `${typedEmoji / 1}` === typedEmoji;
if (!isNumeric || typedEmoji.length >= 3) {
suggestions = getEmojiSuggestions(typedEmoji);
const pickedIdx = suggestions.indexOf(picked);
picked = suggestions[pickedIdx === -1 ? 0 : pickedIdx];
}
}
updateEmojiMark(change, emoji, { typed, suggestions, picked });
}
}