mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 11:39:01 +01:00 
			
		
		
		
	hiding protected session dialog when moving over to unprotected note
This commit is contained in:
		
							parent
							
								
									9cf935efd1
								
							
						
					
					
						commit
						dd5a142fdd
					
				| @ -169,7 +169,7 @@ const noteEditor = (function() { | |||||||
| 
 | 
 | ||||||
|     function setTreeBasedOnProtectedStatus(note) { |     function setTreeBasedOnProtectedStatus(note) { | ||||||
|         const node = treeUtils.getNodeByKey(note.detail.note_id); |         const node = treeUtils.getNodeByKey(note.detail.note_id); | ||||||
|         node.toggleClass("protected", note.detail.is_protected); |         node.toggleClass("protected", !!note.detail.is_protected); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function setNoteBackgroundIfProtected(note) { |     function setNoteBackgroundIfProtected(note) { | ||||||
| @ -202,6 +202,10 @@ const noteEditor = (function() { | |||||||
|             protected_session.touchProtectedSession(); |             protected_session.touchProtectedSession(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         // this might be important if we focused on protected note when not in protected note and we got a dialog
 | ||||||
|  |         // to login, but we chose instead to come to another node - at that point the dialog is still visible and this will close it.
 | ||||||
|  |         protected_session.ensureDialogIsClosed(); | ||||||
|  | 
 | ||||||
|         noteDetailWrapperEl.show(); |         noteDetailWrapperEl.show(); | ||||||
| 
 | 
 | ||||||
|         noteTitleEl.val(currentNote.detail.note_title); |         noteTitleEl.val(currentNote.detail.note_title); | ||||||
|  | |||||||
| @ -69,6 +69,15 @@ const protected_session = (function() { | |||||||
|         noteTree.reload(); |         noteTree.reload(); | ||||||
| 
 | 
 | ||||||
|         if (protectedSessionDeferred !== null) { |         if (protectedSessionDeferred !== null) { | ||||||
|  |             ensureDialogIsClosed(dialogEl, passwordEl); | ||||||
|  | 
 | ||||||
|  |             protectedSessionDeferred.resolve(); | ||||||
|  | 
 | ||||||
|  |             protectedSessionDeferred = null; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     function ensureDialogIsClosed() { | ||||||
|         // this may fal if the dialog has not been previously opened
 |         // this may fal if the dialog has not been previously opened
 | ||||||
|         try { |         try { | ||||||
|             dialogEl.dialog('close'); |             dialogEl.dialog('close'); | ||||||
| @ -76,11 +85,6 @@ const protected_session = (function() { | |||||||
|         catch (e) {} |         catch (e) {} | ||||||
| 
 | 
 | ||||||
|         passwordEl.val(''); |         passwordEl.val(''); | ||||||
| 
 |  | ||||||
|             protectedSessionDeferred.resolve(); |  | ||||||
| 
 |  | ||||||
|             protectedSessionDeferred = null; |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async function enterProtectedSession(password) { |     async function enterProtectedSession(password) { | ||||||
| @ -182,6 +186,7 @@ const protected_session = (function() { | |||||||
|         unprotectNoteAndSendToServer, |         unprotectNoteAndSendToServer, | ||||||
|         getProtectedSessionId, |         getProtectedSessionId, | ||||||
|         touchProtectedSession, |         touchProtectedSession, | ||||||
|         protectSubTree |         protectSubTree, | ||||||
|  |         ensureDialogIsClosed | ||||||
|     }; |     }; | ||||||
| })(); | })(); | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner