Fix autocompletion menu not closing on send

This commit is contained in:
Pavel Djundik 2018-07-31 17:39:03 +03:00 committed by Pavel Djundik
parent 6877199515
commit 1d4ab8fff1

View File

@ -16,6 +16,7 @@ module.exports = {
enable: enableAutocomplete, enable: enableAutocomplete,
disable() { disable() {
if (enabled) { if (enabled) {
$("#form").off("submit.tabcomplete");
input.off("input.tabcomplete"); input.off("input.tabcomplete");
Mousetrap(input.get(0)).unbind("tab", "keydown"); Mousetrap(input.get(0)).unbind("tab", "keydown");
textcomplete.destroy(); textcomplete.destroy();
@ -24,12 +25,6 @@ module.exports = {
}, },
}; };
$("#form").on("submit", () => {
if (enabled) {
textcomplete.hide();
}
});
const emojiSearchTerms = Object.keys(emojiMap); const emojiSearchTerms = Object.keys(emojiMap);
const emojiStrategy = { const emojiStrategy = {
id: "emoji", id: "emoji",
@ -263,6 +258,10 @@ function enableAutocomplete(inputRef) {
textcomplete.on("hidden", () => { textcomplete.on("hidden", () => {
autocompleting = false; autocompleting = false;
}); });
$("#form").on("submit.tabcomplete", () => {
textcomplete.hide();
});
} }
function fuzzyGrep(term, array) { function fuzzyGrep(term, array) {