Compare commits
No commits in common. "8398670530fd34f648d32f92240630ad5f012c5a" and "e8b653737cf50c2d4a73654ea880aace1382f255" have entirely different histories.
8398670530
...
e8b653737c
3 changed files with 1 additions and 40 deletions
|
@ -56,7 +56,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div
|
<div
|
||||||
v-if="!Object.values(loading).includes(false) && !hasAtLeastOneResult"
|
v-if="!loadedInitially"
|
||||||
class="text-center loading-icon"
|
class="text-center loading-icon"
|
||||||
>
|
>
|
||||||
<FAIcon
|
<FAIcon
|
||||||
|
|
|
@ -10,12 +10,6 @@ library.add(
|
||||||
)
|
)
|
||||||
|
|
||||||
const SearchBar = {
|
const SearchBar = {
|
||||||
mounted () {
|
|
||||||
window.addEventListener('keydown', this.autoFocus)
|
|
||||||
},
|
|
||||||
beforeDestroy () {
|
|
||||||
window.removeEventListener('keydown', this.autoFocus)
|
|
||||||
},
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
searchTerm: undefined,
|
searchTerm: undefined,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
|
@ -42,36 +36,6 @@ const SearchBar = {
|
||||||
this.$refs.searchInput.focus()
|
this.$refs.searchInput.focus()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
|
||||||
autoFocus (event) {
|
|
||||||
if (
|
|
||||||
event.target.tagName !== 'BODY' ||
|
|
||||||
event.altKey ||
|
|
||||||
event.ctrlKey ||
|
|
||||||
event.isComposing ||
|
|
||||||
event.metaKey ||
|
|
||||||
event.repeat ||
|
|
||||||
event.shiftKey
|
|
||||||
) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.key === '/') {
|
|
||||||
if (this.hidden) {
|
|
||||||
this.toggleHidden()
|
|
||||||
} else {
|
|
||||||
this.$refs.searchInput.focus()
|
|
||||||
}
|
|
||||||
event.preventDefault()
|
|
||||||
} else if (event.key === 'Escape') {
|
|
||||||
if (!this.hidden) {
|
|
||||||
this.toggleHidden()
|
|
||||||
}
|
|
||||||
event.preventDefault()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
blur () {
|
|
||||||
this.$refs.searchInput.blur()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,6 @@
|
||||||
@keydown.enter="
|
@keydown.enter="
|
||||||
$event.isComposing || $event.keyCode === 229 || find(searchTerm)
|
$event.isComposing || $event.keyCode === 229 || find(searchTerm)
|
||||||
"
|
"
|
||||||
@keydown.escape="
|
|
||||||
$event.isComposing || blur()
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="button-default search-button"
|
class="button-default search-button"
|
||||||
|
|
Loading…
Reference in a new issue