X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/85b7b10c016ba7036309b598fc5b4d23c6f95fdc..refs/pull/5429/head:/resources/js/components/global-search.js diff --git a/resources/js/components/global-search.js b/resources/js/components/global-search.js index 7bc8a1d45..2cdaf591a 100644 --- a/resources/js/components/global-search.js +++ b/resources/js/components/global-search.js @@ -1,7 +1,7 @@ -import {htmlToDom} from "../services/dom"; -import {debounce} from "../services/util"; -import {KeyboardNavigationHandler} from "../services/keyboard-navigation"; -import {Component} from "./component"; +import {htmlToDom} from '../services/dom.ts'; +import {debounce} from '../services/util.ts'; +import {KeyboardNavigationHandler} from '../services/keyboard-navigation.ts'; +import {Component} from './component'; /** * Global (header) search box handling. @@ -25,12 +25,12 @@ export class GlobalSearch extends Component { // Handle search input changes this.input.addEventListener('input', () => { - const value = this.input.value; + const {value} = this.input; if (value.length > 0) { this.loadingWrap.style.display = 'block'; this.suggestionResultsWrap.style.opacity = '0.5'; updateSuggestionsDebounced(value); - } else { + } else { this.hideSuggestions(); } }); @@ -55,7 +55,7 @@ export class GlobalSearch extends Component { if (!this.input.value) { return; } - + const resultDom = htmlToDom(results); this.suggestionResultsWrap.innerHTML = ''; @@ -71,7 +71,7 @@ export class GlobalSearch extends Component { this.container.classList.add('search-active'); window.requestAnimationFrame(() => { this.suggestions.classList.add('search-suggestions-animation'); - }) + }); } hideSuggestions() { @@ -79,4 +79,5 @@ export class GlobalSearch extends Component { this.suggestions.classList.remove('search-suggestions-animation'); this.suggestionResultsWrap.innerHTML = ''; } -} \ No newline at end of file + +}