mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 11:39:01 +01:00 
			
		
		
		
	unhoist note when activating note outside of the hoisted note subtree
This commit is contained in:
		
							parent
							
								
									f763e13996
								
							
						
					
					
						commit
						a680bb4612
					
				| @ -15,6 +15,7 @@ import treeKeyBindings from "./tree_keybindings.js"; | |||||||
| import Branch from '../entities/branch.js'; | import Branch from '../entities/branch.js'; | ||||||
| import NoteShort from '../entities/note_short.js'; | import NoteShort from '../entities/note_short.js'; | ||||||
| import hoistedNoteService from '../services/hoisted_note.js'; | import hoistedNoteService from '../services/hoisted_note.js'; | ||||||
|  | import confirmDialog from "../dialogs/confirm.js"; | ||||||
| 
 | 
 | ||||||
| const $tree = $("#tree"); | const $tree = $("#tree"); | ||||||
| const $createTopLevelNoteButton = $("#create-top-level-note-button"); | const $createTopLevelNoteButton = $("#create-top-level-note-button"); | ||||||
| @ -113,6 +114,17 @@ async function expandToNote(notePath, expandOpts) { | |||||||
| async function activateNote(notePath, newNote) { | async function activateNote(notePath, newNote) { | ||||||
|     utils.assertArguments(notePath); |     utils.assertArguments(notePath); | ||||||
| 
 | 
 | ||||||
|  |     const hoistedNoteId = await hoistedNoteService.getHoistedNoteId(); | ||||||
|  | 
 | ||||||
|  |     if (!notePath.includes(hoistedNoteId)) { | ||||||
|  |         if (!await confirmDialog.confirm("Requested note is outside of hoisted note subtree. Do you want to unhoist?")) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // unhoist so we can activate the note
 | ||||||
|  |         await hoistedNoteService.setHoistedNoteId('root'); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     if (glob.activeDialog) { |     if (glob.activeDialog) { | ||||||
|         glob.activeDialog.modal('hide'); |         glob.activeDialog.modal('hide'); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -151,7 +151,7 @@ function register(app) { | |||||||
|     apiRoute(GET, '/api/recent-changes', recentChangesApiRoute.getRecentChanges); |     apiRoute(GET, '/api/recent-changes', recentChangesApiRoute.getRecentChanges); | ||||||
| 
 | 
 | ||||||
|     apiRoute(GET, '/api/options', optionsApiRoute.getOptions); |     apiRoute(GET, '/api/options', optionsApiRoute.getOptions); | ||||||
|     apiRoute(PUT, '/api/options/:name/:value', optionsApiRoute.updateOption); |     apiRoute(PUT, '/api/options/:name/:value*', optionsApiRoute.updateOption); | ||||||
|     apiRoute(PUT, '/api/options', optionsApiRoute.updateOptions); |     apiRoute(PUT, '/api/options', optionsApiRoute.updateOptions); | ||||||
| 
 | 
 | ||||||
|     apiRoute(POST, '/api/password/change', passwordApiRoute.changePassword); |     apiRoute(POST, '/api/password/change', passwordApiRoute.changePassword); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner