FIX: regression in autocomplete

This commit is contained in:
Sam 2014-10-14 18:22:44 +11:00
parent 737be5e151
commit b4c29a9f3b

View file

@ -261,10 +261,8 @@ export default function(options) {
$(this).keypress(function(e) { $(this).keypress(function(e) {
var caretPosition, term; var caretPosition, term;
if (!options.key) return;
// keep hunting backwards till you hit a the @ key // keep hunting backwards till you hit a the @ key
if (e.which === options.key.charCodeAt(0)) { if (options.key && e.which === options.key.charCodeAt(0)) {
caretPosition = Discourse.Utilities.caretPosition(me[0]); caretPosition = Discourse.Utilities.caretPosition(me[0]);
var prevChar = me.val().charAt(caretPosition - 1); var prevChar = me.val().charAt(caretPosition - 1);
if (!prevChar || /\s/.test(prevChar)) { if (!prevChar || /\s/.test(prevChar)) {