Added custom hotkey support

This commit is contained in:
Robin Schneider 2021-09-11 12:42:57 +02:00
parent 6b54eedae7
commit 584f2b4b32
3 changed files with 11 additions and 2 deletions

View File

@ -19,6 +19,8 @@ logo: "assets/logo.png"
# icon: "fas fa-skull-crossbones"
header: true # Set to false to hide the header
# Optional: Different hotkey for search, defaults to "/"
# hotkey: "Shift"
footer: '<p>Created with <span class="has-text-danger">❤️</span> with <a href="https://bulma.io/">bulma</a>, <a href="https://vuejs.org/">vuejs</a> & <a href="https://fontawesome.com/">font awesome</a> // Fork me on <a href="https://github.com/bastienwirtz/homer"><i class="fab fa-github-alt"></i></a></p>' # set false if you want to hide it.
columns: "3" # "auto" or number (must be a factor of 12: 1, 2, 3, 4, 6, 12)

View File

@ -41,6 +41,7 @@
<SearchInput
class="navbar-item is-inline-block-mobile"
:hotkey="config.hotkey"
@input="filterServices"
@search-focus="showMenu = true"
@search-open="navigateToFirstService"

View File

@ -15,10 +15,16 @@
<script>
export default {
name: "SearchInput",
props: ["value"],
props: {
value: String,
hotkey: {
type: String,
default: "/"
}
},
mounted() {
this._keyListener = function (event) {
if (event.key === "/") {
if (event.key === this.hotkey) {
event.preventDefault();
this.focus();
}