changed note selection in tree using keyboard - now only sibling nodes are selected

This commit is contained in:
zadam
2019-11-24 22:01:10 +01:00
parent 6bbd4c59bc
commit 1e979d71c7
4 changed files with 35 additions and 22 deletions
+15 -6
View File
@@ -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
};