FIX: Don't append when there is nothing to append.

This commit is contained in:
Guo Xiang Tan 2015-10-03 17:22:13 +08:00
parent 904a36eea2
commit 8b59f76f59
1 changed files with 7 additions and 4 deletions

View File

@ -130,12 +130,15 @@ export default function(options) {
if (options.transformComplete) {
term = options.transformComplete(term);
}
if (term) {
var text = me.val();
text = text.substring(0, completeStart) + (options.key || "") + term + ' ' + text.substring(completeEnd + 1, text.length);
me.val(text);
Discourse.Utilities.setCaretPosition(me[0], completeStart + 1 + term.length);
}
}
}
closeAutocomplete();
};