]> git.immae.eu Git - github/bastienwirtz/homer.git/commitdiff
Merge branch 'bastienwirtz:main' into hotkey
authorRobin Schneider <45321827+robinschneider@users.noreply.github.com>
Sun, 10 Oct 2021 19:40:42 +0000 (21:40 +0200)
committerGitHub <noreply@github.com>
Sun, 10 Oct 2021 19:40:42 +0000 (21:40 +0200)
docs/configuration.md
src/App.vue
src/components/SearchInput.vue

index e4ddfcf34b0604d80c290519213f0a0f95b9e0c4..c554297362b2fb836dfb7d12277a18e4a79fb09c 100644 (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)
index c263c8a0572ee096ba8ca6e17c63cf09568a378f..5e717969137e0e0a0c94010f7f800bb6f027d226 100644 (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"
index 40c5a1de1e02981705ca763e50234c9130f34e64..586ff712886b775857608c27a7a39a684f0305d1 100644 (file)
 <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();
       }
@@ -28,7 +34,7 @@ export default {
     };
     document.addEventListener("keydown", this._keyListener.bind(this));
 
-    // fill seach from get parameter.
+    // fill search from get parameter.
     const search = new URLSearchParams(window.location.search).get("search");
     if (search) {
       this.$refs.search.value = search;