mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	saved search note now has refresh button, closes #369
This commit is contained in:
		
							parent
							
								
									f479c0e10e
								
							
						
					
					
						commit
						7bbf797caf
					
				| @ -107,6 +107,8 @@ $("#logout-button").click(() => { | |||||||
| 
 | 
 | ||||||
| $("#tree").on("click", ".unhoist-button", hoistedNoteService.unhoist); | $("#tree").on("click", ".unhoist-button", hoistedNoteService.unhoist); | ||||||
| 
 | 
 | ||||||
|  | $("#tree").on("click", ".refresh-search-button", searchNotesService.refreshSearch); | ||||||
|  | 
 | ||||||
| $("body").on("click", "a.external", function () { | $("body").on("click", "a.external", function () { | ||||||
|     window.open($(this).attr("href"), '_blank'); |     window.open($(this).attr("href"), '_blank'); | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -1,6 +1,5 @@ | |||||||
| import noteDetailService from "./note_detail.js"; | import noteDetailService from "./note_detail.js"; | ||||||
| import treeService from "./tree.js"; | import searchNotesService from "./search_notes.js"; | ||||||
| import infoService from './info.js'; |  | ||||||
| 
 | 
 | ||||||
| const $searchString = $("#search-string"); | const $searchString = $("#search-string"); | ||||||
| const $component = $('#note-detail-search'); | const $component = $('#note-detail-search'); | ||||||
| @ -31,9 +30,7 @@ function getContent() { | |||||||
| $refreshButton.click(async () => { | $refreshButton.click(async () => { | ||||||
|     await noteDetailService.saveNoteIfChanged(); |     await noteDetailService.saveNoteIfChanged(); | ||||||
| 
 | 
 | ||||||
|     treeService.reload(); |     await searchNotesService.refreshSearch(); | ||||||
| 
 |  | ||||||
|     infoService.showMessage('Tree has been refreshed.'); |  | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|  | |||||||
| @ -96,6 +96,15 @@ async function saveSearch() { | |||||||
|     resetSearch(); |     resetSearch(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | async function refreshSearch() { | ||||||
|  |     const activeNode = treeService.getActiveNode(); | ||||||
|  | 
 | ||||||
|  |     activeNode.load(true); | ||||||
|  |     activeNode.setExpanded(true); | ||||||
|  | 
 | ||||||
|  |     infoService.showMessage("Saved search note refreshed."); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function init() { | function init() { | ||||||
|     const hashValue = treeService.getHashValueFromAddress(); |     const hashValue = treeService.getHashValueFromAddress(); | ||||||
| 
 | 
 | ||||||
| @ -129,6 +138,7 @@ export default { | |||||||
|     toggleSearch, |     toggleSearch, | ||||||
|     resetSearch, |     resetSearch, | ||||||
|     showSearch, |     showSearch, | ||||||
|  |     refreshSearch, | ||||||
|     doSearch, |     doSearch, | ||||||
|     init |     init | ||||||
| }; | }; | ||||||
| @ -453,6 +453,14 @@ function initFancyTree(tree) { | |||||||
| 
 | 
 | ||||||
|                 $span.append(unhoistButton); |                 $span.append(unhoistButton); | ||||||
|             } |             } | ||||||
|  | 
 | ||||||
|  |             const note = await treeCache.getNote(node.data.noteId); | ||||||
|  | 
 | ||||||
|  |             if (note.type === 'search' && $span.find('.refresh-search-button').length === 0) { | ||||||
|  |                 const refreshSearchButton = $('<span>  <span class="refresh-search-button jam jam-refresh" title="Refresh saved search results"></span></span>'); | ||||||
|  | 
 | ||||||
|  |                 $span.append(refreshSearchButton); | ||||||
|  |             } | ||||||
|         }, |         }, | ||||||
|         // this is done to automatically lazy load all expanded search notes after tree load
 |         // this is done to automatically lazy load all expanded search notes after tree load
 | ||||||
|         loadChildren: function(event, data) { |         loadChildren: function(event, data) { | ||||||
|  | |||||||
| @ -134,3 +134,9 @@ li.dropdown-submenu:hover > ul.dropdown-menu { | |||||||
|     text-decoration: underline; |     text-decoration: underline; | ||||||
|     transform: rotate(-90deg); |     transform: rotate(-90deg); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | .refresh-search-button { | ||||||
|  |     cursor: pointer; | ||||||
|  |     position: relative; | ||||||
|  |     top: -1px; | ||||||
|  | } | ||||||
| @ -5,7 +5,7 @@ | |||||||
| 
 | 
 | ||||||
|         <span> |         <span> | ||||||
|                 |                 | ||||||
|             <button type="button" class="btn btn-primary" id="note-detail-search-refresh-results-button">Refresh tree</button> |             <button type="button" class="btn btn-primary" id="note-detail-search-refresh-results-button">Refresh search results</button> | ||||||
|         </span> |         </span> | ||||||
|     </div> |     </div> | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam