mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-01-25 14:38:29 -06:00
fix keyboard shortcut setup on mobile
This commit is contained in:
@@ -5,13 +5,17 @@ import treeCache from "./tree_cache.js";
|
||||
import treeBuilder from "./tree_builder.js";
|
||||
|
||||
const $tree = $("#tree");
|
||||
const $detail = $("#detail");
|
||||
|
||||
$detail.on('hide.bs.modal', e => {
|
||||
$tree.show();
|
||||
});
|
||||
|
||||
async function showTree() {
|
||||
const tree = await treeService.loadTree();
|
||||
|
||||
$tree.fancytree({
|
||||
autoScroll: true,
|
||||
keyboard: false, // we takover keyboard handling in the hotkeys plugin
|
||||
extensions: ["dnd5", "clones"],
|
||||
source: tree,
|
||||
scrollParent: $tree,
|
||||
@@ -24,7 +28,9 @@ async function showTree() {
|
||||
|
||||
noteDetailService.switchToNote(noteId, true);
|
||||
|
||||
$("#detail").modal();
|
||||
$tree.hide();
|
||||
|
||||
$detail.modal();
|
||||
},
|
||||
expand: (event, data) => treeService.setExpandedToServer(data.node.data.branchId, true),
|
||||
collapse: (event, data) => treeService.setExpandedToServer(data.node.data.branchId, false),
|
||||
|
||||
@@ -136,11 +136,13 @@ function randomString(len) {
|
||||
}
|
||||
|
||||
function bindShortcut(keyboardShortcut, handler) {
|
||||
$(document).bind('keydown', keyboardShortcut, e => {
|
||||
handler();
|
||||
if (isDesktop()) {
|
||||
$(document).bind('keydown', keyboardShortcut, e => {
|
||||
handler();
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function isMobile() {
|
||||
|
||||
Reference in New Issue
Block a user