mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-17 12:41:20 +08:00
chore(deps): update dependency refs-cli to ^1.3.2 (#279) f31aab4b35
This commit is contained in:
11
js/main.js
11
js/main.js
@ -74,20 +74,21 @@ let inputValue = '';
|
||||
let activeIndex = 0
|
||||
|
||||
document.addEventListener('keydown', (ev) => {
|
||||
if (ev.key.toLocaleLowerCase() === 'escape') {
|
||||
const key = ev.key.toLocaleLowerCase();
|
||||
if (key === 'escape') {
|
||||
hideSearch();
|
||||
}
|
||||
if (ev.metaKey && ev.key.toLocaleLowerCase() === 'k') {
|
||||
if ((ev.metaKey || ev.ctrlKey) && key === 'k') {
|
||||
searchBox.classList.contains('show') ? hideSearch() : showSearch();
|
||||
}
|
||||
if (ev.key.toLocaleLowerCase() === 'enter') {
|
||||
if (key === 'enter') {
|
||||
const url = activeMenu.path || activeMenu?.item.path;
|
||||
window.location.href = getDocUrl(url);
|
||||
}
|
||||
if (ev.key.toLocaleLowerCase() === 'arrowdown') {
|
||||
if (key === 'arrowdown') {
|
||||
activeAnchorElm('down')
|
||||
}
|
||||
if (ev.key.toLocaleLowerCase() === 'arrowup') {
|
||||
if (key === 'arrowup') {
|
||||
activeAnchorElm('up')
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user