mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-05-06 12:19:20 -05:00
changed note selection in tree using keyboard - now only sibling nodes are selected
This commit is contained in:
@@ -137,11 +137,7 @@ function bindGlobalShortcut(keyboardShortcut, handler) {
|
||||
|
||||
function bindElShortcut($el, keyboardShortcut, handler) {
|
||||
if (isDesktop()) {
|
||||
keyboardShortcut = keyboardShortcut
|
||||
.toLowerCase()
|
||||
.replace("enter", "return")
|
||||
.replace("ctrl+alt", "alt+ctrl")
|
||||
.replace("meta+alt", "alt+meta"); // alt needs to be first
|
||||
keyboardShortcut = normalizeShortcut(keyboardShortcut);
|
||||
|
||||
$el.bind('keydown', keyboardShortcut, e => {
|
||||
handler(e);
|
||||
@@ -152,6 +148,18 @@ function bindElShortcut($el, keyboardShortcut, handler) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize to the form expected by the jquery.hotkeys.js
|
||||
*/
|
||||
function normalizeShortcut(shortcut) {
|
||||
return shortcut
|
||||
.toLowerCase()
|
||||
.replace("enter", "return")
|
||||
.replace("delete", "del")
|
||||
.replace("ctrl+alt", "alt+ctrl")
|
||||
.replace("meta+alt", "alt+meta"); // alt needs to be first;
|
||||
}
|
||||
|
||||
function isMobile() {
|
||||
return window.device === "mobile"
|
||||
// window.device is not available in setup
|
||||
@@ -260,5 +268,6 @@ export default {
|
||||
closeActiveDialog,
|
||||
isHtmlEmpty,
|
||||
clearBrowserCache,
|
||||
getUrlForDownload
|
||||
getUrlForDownload,
|
||||
normalizeShortcut
|
||||
};
|
||||
Reference in New Issue
Block a user