mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	fix keyboard shortcut setup on mobile
This commit is contained in:
		
							parent
							
								
									35cf8026b0
								
							
						
					
					
						commit
						eeb62a6cf2
					
				| @ -5,13 +5,17 @@ import treeCache from "./tree_cache.js"; | |||||||
| import treeBuilder from "./tree_builder.js"; | import treeBuilder from "./tree_builder.js"; | ||||||
| 
 | 
 | ||||||
| const $tree = $("#tree"); | const $tree = $("#tree"); | ||||||
|  | const $detail = $("#detail"); | ||||||
|  | 
 | ||||||
|  | $detail.on('hide.bs.modal', e => { | ||||||
|  |    $tree.show(); | ||||||
|  | }); | ||||||
| 
 | 
 | ||||||
| async function showTree() { | async function showTree() { | ||||||
|     const tree = await treeService.loadTree(); |     const tree = await treeService.loadTree(); | ||||||
| 
 | 
 | ||||||
|     $tree.fancytree({ |     $tree.fancytree({ | ||||||
|         autoScroll: true, |         autoScroll: true, | ||||||
|         keyboard: false, // we takover keyboard handling in the hotkeys plugin
 |  | ||||||
|         extensions: ["dnd5", "clones"], |         extensions: ["dnd5", "clones"], | ||||||
|         source: tree, |         source: tree, | ||||||
|         scrollParent: $tree, |         scrollParent: $tree, | ||||||
| @ -24,7 +28,9 @@ async function showTree() { | |||||||
| 
 | 
 | ||||||
|             noteDetailService.switchToNote(noteId, true); |             noteDetailService.switchToNote(noteId, true); | ||||||
| 
 | 
 | ||||||
|             $("#detail").modal(); |             $tree.hide(); | ||||||
|  | 
 | ||||||
|  |             $detail.modal(); | ||||||
|         }, |         }, | ||||||
|         expand: (event, data) => treeService.setExpandedToServer(data.node.data.branchId, true), |         expand: (event, data) => treeService.setExpandedToServer(data.node.data.branchId, true), | ||||||
|         collapse: (event, data) => treeService.setExpandedToServer(data.node.data.branchId, false), |         collapse: (event, data) => treeService.setExpandedToServer(data.node.data.branchId, false), | ||||||
|  | |||||||
| @ -136,12 +136,14 @@ function randomString(len) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function bindShortcut(keyboardShortcut, handler) { | function bindShortcut(keyboardShortcut, handler) { | ||||||
|  |     if (isDesktop()) { | ||||||
|         $(document).bind('keydown', keyboardShortcut, e => { |         $(document).bind('keydown', keyboardShortcut, e => { | ||||||
|             handler(); |             handler(); | ||||||
| 
 | 
 | ||||||
|             e.preventDefault(); |             e.preventDefault(); | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| function isMobile() { | function isMobile() { | ||||||
|     return window.device === "mobile"; |     return window.device === "mobile"; | ||||||
|  | |||||||
| @ -19,6 +19,8 @@ | |||||||
|                 </button> |                 </button> | ||||||
|             </div> |             </div> | ||||||
|             <div class="modal-body"> |             <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-text" class="note-detail-component" tabindex="10000"></div> | ||||||
| 
 | 
 | ||||||
|                 <div id="note-detail-code" class="note-detail-component"></div> |                 <div id="note-detail-code" class="note-detail-component"></div> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner