From f9d255b678f3910349af2d93da5adca1ae01294f Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 9 Jul 2018 21:53:49 +0300 Subject: [PATCH] Passthrough input ref --- client/components/ChatInput.vue | 2 +- client/js/autocompletion.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/components/ChatInput.vue b/client/components/ChatInput.vue index fc44db31..9129b644 100644 --- a/client/components/ChatInput.vue +++ b/client/components/ChatInput.vue @@ -67,7 +67,7 @@ export default { }, mounted() { if (this.$root.settings.autocomplete) { - require("../js/autocompletion").enable(); + require("../js/autocompletion").enable(this.$refs.input); } const inputTrap = Mousetrap(this.$refs.input); diff --git a/client/js/autocompletion.js b/client/js/autocompletion.js index 5a28c4f6..a426d8ab 100644 --- a/client/js/autocompletion.js +++ b/client/js/autocompletion.js @@ -172,12 +172,12 @@ const backgroundColorStrategy = { index: 2, }; -function enableAutocomplete() { +function enableAutocomplete(inputRef) { enabled = true; let tabCount = 0; let lastMatch = ""; let currentMatches = []; - input = $("#input"); + input = $(inputRef); input.on("input.tabcomplete", () => { tabCount = 0;