mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01: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) { | ||||
|     if (isDesktop()) { | ||||
|         $(document).bind('keydown', keyboardShortcut, e => { | ||||
|             handler(); | ||||
|  | ||||
|             e.preventDefault(); | ||||
|         }); | ||||
|     } | ||||
| } | ||||
|  | ||||
| function isMobile() { | ||||
|   | ||||
| @@ -19,6 +19,8 @@ | ||||
|                 </button> | ||||
|             </div> | ||||
|             <div class="modal-body"> | ||||
|                 <span id="saved-indicator" title="All changes have been saved" class="jam jam-check"></span> | ||||
|  | ||||
|                 <div id="note-detail-text" class="note-detail-component" tabindex="10000"></div> | ||||
|  | ||||
|                 <div id="note-detail-code" class="note-detail-component"></div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user