mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	Compare commits
	
		
			8 Commits
		
	
	
		
			v0.37.1-be
			...
			v0.37.3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | d357943ebb | ||
|  | 07043fb177 | ||
|  | 1f8d382b1f | ||
|  | 61e8cbbcba | ||
|  | 86c5dd6494 | ||
|  | c5acb7fc9b | ||
|  | 834e1f7253 | ||
|  | 1a87190f43 | 
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "version": "0.36.5", |   "version": "0.37.2", | ||||||
|   "lockfileVersion": 1, |   "lockfileVersion": 1, | ||||||
|   "requires": true, |   "requires": true, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "productName": "Trilium Notes", |   "productName": "Trilium Notes", | ||||||
|   "description": "Trilium Notes", |   "description": "Trilium Notes", | ||||||
|   "version": "0.37.1-beta", |   "version": "0.37.3", | ||||||
|   "license": "AGPL-3.0-only", |   "license": "AGPL-3.0-only", | ||||||
|   "main": "electron.js", |   "main": "electron.js", | ||||||
|   "bin": { |   "bin": { | ||||||
|   | |||||||
| @@ -142,6 +142,12 @@ async function refreshSearch() { | |||||||
|     toastService.showMessage("Saved search note refreshed."); |     toastService.showMessage("Saved search note refreshed."); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function searchInSubtree(noteId) { | ||||||
|  |     showSearch(); | ||||||
|  |  | ||||||
|  |     $searchInput.val(`@in=${noteId} @text*=*`); | ||||||
|  | } | ||||||
|  |  | ||||||
| function init() { | function init() { | ||||||
|     const hashValue = document.location.hash ? document.location.hash.substr(1) : ""; // strip initial # |     const hashValue = document.location.hash ? document.location.hash.substr(1) : ""; // strip initial # | ||||||
|  |  | ||||||
| @@ -178,5 +184,6 @@ export default { | |||||||
|     refreshSearch, |     refreshSearch, | ||||||
|     doSearch, |     doSearch, | ||||||
|     init, |     init, | ||||||
|  |     searchInSubtree, | ||||||
|     getHelpText: () => helpText |     getHelpText: () => helpText | ||||||
| }; | }; | ||||||
| @@ -148,7 +148,7 @@ class TreeCache { | |||||||
|             else { |             else { | ||||||
|                 return this.notes[noteId]; |                 return this.notes[noteId]; | ||||||
|             } |             } | ||||||
|         }).filter(note => note !== null); |         }).filter(note => !!note); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @return {Promise<boolean>} */ |     /** @return {Promise<boolean>} */ | ||||||
|   | |||||||
| @@ -9,6 +9,7 @@ import hoistedNoteService from './hoisted_note.js'; | |||||||
| import noteDetailService from './note_detail.js'; | import noteDetailService from './note_detail.js'; | ||||||
| import clipboard from './clipboard.js'; | import clipboard from './clipboard.js'; | ||||||
| import protectedSessionHolder from "./protected_session_holder.js"; | import protectedSessionHolder from "./protected_session_holder.js"; | ||||||
|  | import searchNotesService from "./search_notes.js"; | ||||||
|  |  | ||||||
| class TreeContextMenu { | class TreeContextMenu { | ||||||
|     constructor(node) { |     constructor(node) { | ||||||
| @@ -55,6 +56,8 @@ class TreeContextMenu { | |||||||
|             { title: "Delete <kbd>Delete</kbd>", cmd: "delete", uiIcon: "trash", |             { title: "Delete <kbd>Delete</kbd>", cmd: "delete", uiIcon: "trash", | ||||||
|                 enabled: isNotRoot && !isHoisted && parentNotSearch }, |                 enabled: isNotRoot && !isHoisted && parentNotSearch }, | ||||||
|             { title: "----" }, |             { title: "----" }, | ||||||
|  |             { title: "Search in subtree <kbd>Ctrl+Shift+S</kbd>", cmd: "searchInSubtree", uiIcon: "search", | ||||||
|  |                 enabled: notSearch && noSelectedNotes }, | ||||||
|             isHoisted ? null : { title: "Hoist note <kbd>Ctrl-H</kbd>", cmd: "hoist", uiIcon: "empty", enabled: noSelectedNotes && notSearch }, |             isHoisted ? null : { title: "Hoist note <kbd>Ctrl-H</kbd>", cmd: "hoist", uiIcon: "empty", enabled: noSelectedNotes && notSearch }, | ||||||
|             !isHoisted || !isNotRoot ? null : { title: "Unhoist note <kbd>Ctrl-H</kbd>", cmd: "unhoist", uiIcon: "arrow-up" }, |             !isHoisted || !isNotRoot ? null : { title: "Unhoist note <kbd>Ctrl-H</kbd>", cmd: "unhoist", uiIcon: "arrow-up" }, | ||||||
|             { title: "Edit branch prefix <kbd>F2</kbd>", cmd: "editBranchPrefix", uiIcon: "empty", |             { title: "Edit branch prefix <kbd>F2</kbd>", cmd: "editBranchPrefix", uiIcon: "empty", | ||||||
| @@ -177,6 +180,9 @@ class TreeContextMenu { | |||||||
|  |  | ||||||
|             treeService.duplicateNote(this.node.data.noteId, branch.parentNoteId); |             treeService.duplicateNote(this.node.data.noteId, branch.parentNoteId); | ||||||
|         } |         } | ||||||
|  |         else if (cmd === "searchInSubtree") { | ||||||
|  |             searchNotesService.searchInSubtree(this.node.data.noteId); | ||||||
|  |         } | ||||||
|         else { |         else { | ||||||
|             ws.logError("Unknown command: " + cmd); |             ws.logError("Unknown command: " + cmd); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ import treeService from "./tree.js"; | |||||||
| import hoistedNoteService from "./hoisted_note.js"; | import hoistedNoteService from "./hoisted_note.js"; | ||||||
| import clipboard from "./clipboard.js"; | import clipboard from "./clipboard.js"; | ||||||
| import treeCache from "./tree_cache.js"; | import treeCache from "./tree_cache.js"; | ||||||
|  | import searchNoteService from "./search_notes.js"; | ||||||
|  |  | ||||||
| const keyBindings = { | const keyBindings = { | ||||||
|     "del": node => { |     "del": node => { | ||||||
| @@ -167,6 +168,11 @@ const keyBindings = { | |||||||
|     "down": node => { |     "down": node => { | ||||||
|         node.navigate($.ui.keyCode.DOWN, true).then(treeService.clearSelectedNodes); |         node.navigate($.ui.keyCode.DOWN, true).then(treeService.clearSelectedNodes); | ||||||
|  |  | ||||||
|  |         return false; | ||||||
|  |     }, | ||||||
|  |     "ctrl+shift+s": node => { | ||||||
|  |         searchNoteService.searchInSubtree(node.data.noteId); | ||||||
|  |  | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ async function getRecentChanges() { | |||||||
|                 note_revisions |                 note_revisions | ||||||
|                 JOIN notes USING(noteId) |                 JOIN notes USING(noteId) | ||||||
|             ORDER BY |             ORDER BY | ||||||
|                 utcDateCreated DESC |                 note_revisions.utcDateCreated DESC | ||||||
|             LIMIT 1000 |             LIMIT 1000 | ||||||
|         ) |         ) | ||||||
|         UNION ALL SELECT * FROM ( |         UNION ALL SELECT * FROM ( | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| module.exports = { buildDate:"2019-11-16T19:09:52+01:00", buildRevision: "1838f097e537eedc958b52ee82093e43ab5b9908" }; | module.exports = { buildDate:"2019-11-19T23:05:54+01:00", buildRevision: "07043fb177afb9d754428a410b3019d53d7b6fa0" }; | ||||||
|   | |||||||
| @@ -67,7 +67,7 @@ module.exports = function(filters, selectedColumns = 'notes.*') { | |||||||
|     const params = []; |     const params = []; | ||||||
|  |  | ||||||
|     for (const filter of filters) { |     for (const filter of filters) { | ||||||
|         if (['isarchived', 'orderby', 'limit'].includes(filter.name.toLowerCase())) { |         if (['isarchived', 'in', 'orderby', 'limit'].includes(filter.name.toLowerCase())) { | ||||||
|             continue; // these are not real filters |             continue; // these are not real filters | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -56,6 +56,8 @@ async function checkContentHashes(otherHashes) { | |||||||
|         if (hashes[key] !== otherHashes[key]) { |         if (hashes[key] !== otherHashes[key]) { | ||||||
|             allChecksPassed = false; |             allChecksPassed = false; | ||||||
|  |  | ||||||
|  |             log.info(`Content hash check for ${key} FAILED. Local is ${hashes[key]}, remote is ${otherHashes[key]}`); | ||||||
|  |  | ||||||
|             if (key !== 'recent_notes') { |             if (key !== 'recent_notes') { | ||||||
|                 // let's not get alarmed about recent notes which get updated often and can cause failures in race conditions |                 // let's not get alarmed about recent notes which get updated often and can cause failures in race conditions | ||||||
|                 ws.sendMessageToAllClients({type: 'sync-hash-check-failed'}); |                 ws.sendMessageToAllClients({type: 'sync-hash-check-failed'}); | ||||||
|   | |||||||
| @@ -255,6 +255,25 @@ function isArchived(noteId) { | |||||||
|     return isNotePathArchived(notePath); |     return isNotePathArchived(notePath); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * @param {string} noteId | ||||||
|  |  * @param {string} ancestorNoteId | ||||||
|  |  * @return {boolean} - true if given noteId has ancestorNoteId in any of its paths (even archived) | ||||||
|  |  */ | ||||||
|  | function isInAncestor(noteId, ancestorNoteId) { | ||||||
|  |     if (ancestorNoteId === noteId) { // special case | ||||||
|  |         return true; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     for (const parentNoteId of childToParent[noteId] || []) { | ||||||
|  |         if (isInAncestor(parentNoteId, ancestorNoteId)) { | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     return false; | ||||||
|  | } | ||||||
|  |  | ||||||
| function getNoteTitleFromPath(notePath) { | function getNoteTitleFromPath(notePath) { | ||||||
|     const pathArr = notePath.split("/"); |     const pathArr = notePath.split("/"); | ||||||
|  |  | ||||||
| @@ -529,6 +548,7 @@ module.exports = { | |||||||
|     getNoteTitleFromPath, |     getNoteTitleFromPath, | ||||||
|     isAvailable, |     isAvailable, | ||||||
|     isArchived, |     isArchived, | ||||||
|  |     isInAncestor, | ||||||
|     load, |     load, | ||||||
|     findSimilarNotes |     findSimilarNotes | ||||||
| }; | }; | ||||||
| @@ -35,6 +35,20 @@ async function searchForNoteIds(searchString) { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         const isInFilter = filters.find(filter => filter.name.toLowerCase() === 'in'); | ||||||
|  |  | ||||||
|  |         if (isInFilter) { | ||||||
|  |             if (isInFilter.operator === '=') { | ||||||
|  |                 noteIds = noteIds.filter(noteId => noteCacheService.isInAncestor(noteId, isInFilter.value)); | ||||||
|  |             } | ||||||
|  |             else if (isInFilter.operator === '!=') { | ||||||
|  |                 noteIds = noteIds.filter(noteId => !noteCacheService.isInAncestor(noteId, isInFilter.value)); | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 throw new Error(`Unrecognized isIn operator ${isInFilter.operator}`); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|         const limitFilter = filters.find(filter => filter.name.toLowerCase() === 'limit'); |         const limitFilter = filters.find(filter => filter.name.toLowerCase() === 'limit'); | ||||||
|  |  | ||||||
|         if (limitFilter) { |         if (limitFilter) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user