FIX: Don't append when there is nothing to append.
This commit is contained in:
parent
904a36eea2
commit
8b59f76f59
|
@ -130,10 +130,13 @@ export default function(options) {
|
|||
if (options.transformComplete) {
|
||||
term = options.transformComplete(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);
|
||||
|
||||
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();
|
||||
|
|
Loading…
Reference in New Issue