FIX: Don't append when there is nothing to append.
This commit is contained in:
parent
904a36eea2
commit
8b59f76f59
|
@ -130,12 +130,15 @@ export default function(options) {
|
||||||
if (options.transformComplete) {
|
if (options.transformComplete) {
|
||||||
term = options.transformComplete(term);
|
term = options.transformComplete(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (term) {
|
||||||
var text = me.val();
|
var text = me.val();
|
||||||
text = text.substring(0, completeStart) + (options.key || "") + term + ' ' + text.substring(completeEnd + 1, text.length);
|
text = text.substring(0, completeStart) + (options.key || "") + term + ' ' + text.substring(completeEnd + 1, text.length);
|
||||||
me.val(text);
|
me.val(text);
|
||||||
Discourse.Utilities.setCaretPosition(me[0], completeStart + 1 + term.length);
|
Discourse.Utilities.setCaretPosition(me[0], completeStart + 1 + term.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
closeAutocomplete();
|
closeAutocomplete();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue