From 3f2e887aec215c28085fa57547840ef4b4a4c7f4 Mon Sep 17 00:00:00 2001 From: KoloMl Date: Thu, 30 May 2024 21:55:41 +0400 Subject: [PATCH] Fixed issues marked by linter --- assets/js/autocomplete.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/assets/js/autocomplete.js b/assets/js/autocomplete.js index 392af624..9ac4c2b8 100644 --- a/assets/js/autocomplete.js +++ b/assets/js/autocomplete.js @@ -4,19 +4,17 @@ import { LocalAutocompleter } from './utils/local-autocompleter'; import { handleError } from './utils/requests'; -import { getTermContexts } from "./match_query"; +import { getTermContexts } from './match_query'; const cache = {}; /** @type {HTMLInputElement} */ let inputField, - /** @type {string} */ - originalTerm, - /** @type {string} */ - originalQuery, - /** @type {TermContext[]} */ - searchTokens, - /** @type {TermContext} */ - selectedTerm; + /** @type {string} */ + originalTerm, + /** @type {string} */ + originalQuery, + /** @type {TermContext} */ + selectedTerm; function removeParent() { const parent = document.querySelector('.autocomplete'); @@ -86,7 +84,7 @@ function keydownHandler(event) { if (selectedTerm && firstItem && (event.keyCode === 37 || event.keyCode === 39)) { // ArrowLeft || ArrowRight requestAnimationFrame(() => { if (isSelectionOutsideCurrentTerm()) removeParent(); - }) + }); } } @@ -213,7 +211,8 @@ function listenAutocomplete() { } originalTerm = selectedTerm[1]; - } else { + } + else { originalTerm = `${inputField.value}`.toLowerCase(); }