mirror of
https://github.com/sissbruecker/linkding
synced 2024-11-10 06:04:15 +00:00
Feature: Shortcut key for new bookmark (#241)
* Add shortcut key for new bookmark * Use location.assign to keep history Co-authored-by: Sascha Ißbrücker <sascha.issbruecker@gmail.com>
This commit is contained in:
parent
6dd07edf90
commit
c97d5c3dc5
1 changed files with 15 additions and 0 deletions
|
@ -61,6 +61,21 @@
|
|||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// Add new bookmark
|
||||
document.addEventListener('keydown', function(event) {
|
||||
// Filter for new entry shortcut key
|
||||
if (event.key !== 'n') return;
|
||||
// Skip if event occurred within an input element
|
||||
const targetNodeName = event.target.nodeName;
|
||||
const isInputTarget = targetNodeName === 'INPUT'
|
||||
|| targetNodeName === 'SELECT'
|
||||
|| targetNodeName === 'TEXTAREA';
|
||||
|
||||
if (isInputTarget) return;
|
||||
|
||||
window.location.assign("/bookmarks/new");
|
||||
});
|
||||
}
|
||||
|
||||
initConfirmationButtons();
|
||||
|
|
Loading…
Reference in a new issue