feature? is it easy to change the key combo that shows the search box?
Opened this issue · 3 comments
damien1 commented
Is it possible to change from cmd+/ to something like Ctrl+S
I'm looking at selenium and automated testing but currently I cant get it to send keys cmd+/
Theys96 commented
I would like to make it possible -but I'm not sure how yet- to configure the Javascript from the config.yml
. There are multiple ways to do this.
Ctrl+S is reserved for saving though, but you can change this snippet:
hugo-fuse-search/assets/js/fuse-search.js
Lines 109 to 128 in 61ac9cf
To trigger initSearch()
with -say- the .
key:
// This component is controlled with the keyboard:
keyboardHandler(e, component) {
if (event.metaKey && event.which === 191) { // Cmd + /
component.initSearch();
} else {
switch(e.keyCode) {
case 46: // PERIOD
component.initSearch();
break;
case 27: // ESC
component.closeSearch();
break;
case 40: // DOWN
component.navigateDown(e);
break;
case 38: // UP
component.navigateUp(e);
break;
}
}
}