Open link article in new tab if user presses shift+enter

This commit is contained in:
Akbar Rahman 2021-08-24 15:36:03 +01:00
parent 7654745cf0
commit 8871faaef0

View File

@ -68,10 +68,16 @@ function updateResults() {
}
searchBar.addEventListener('keyup', e => {
console.log(e)
// if user pressed enter
if (e.keyCode === 13) {
if (e.shiftKey) {
window.open(results[0].item.path, '_blank')
} else {
window.location.href = results[0].item.path
}
return
}
updateResults()
})
searchBar.addEventListener('change', updateResults)