mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	introducing hidden notes, WIP
This commit is contained in:
		
							parent
							
								
									882912826f
								
							
						
					
					
						commit
						e48609aa68
					
				| @ -139,10 +139,11 @@ export default class DesktopLayout { | |||||||
|                                         .child(new SearchResultWidget()) |                                         .child(new SearchResultWidget()) | ||||||
|                                         .child(new SqlResultWidget()) |                                         .child(new SqlResultWidget()) | ||||||
|                                 ) |                                 ) | ||||||
|  |                                 .child(...this.customWidgets.get('node-detail-pane')) | ||||||
|  |                             ) | ||||||
|  |                         ) | ||||||
|                         .child(...this.customWidgets.get('center-pane')) |                         .child(...this.customWidgets.get('center-pane')) | ||||||
|                     ) |                     ) | ||||||
|                         ) |  | ||||||
|                     ) |  | ||||||
|                     .child(new RightPaneContainer() |                     .child(new RightPaneContainer() | ||||||
|                         .child(...this.customWidgets.get('right-pane')) |                         .child(...this.customWidgets.get('right-pane')) | ||||||
|                     ) |                     ) | ||||||
|  | |||||||
| @ -550,6 +550,10 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         for (const branch of childBranches) { |         for (const branch of childBranches) { | ||||||
|  |             if (branch.noteId === 'hidden') { | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             if (hideArchivedNotes) { |             if (hideArchivedNotes) { | ||||||
|                 const note = branch.getNoteFromCache(); |                 const note = branch.getNoteFromCache(); | ||||||
| 
 | 
 | ||||||
| @ -869,7 +873,11 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | |||||||
|             oldActiveNode.setFocus(false); |             oldActiveNode.setFocus(false); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (this.noteContext && this.noteContext.notePath && !this.noteContext.note.isDeleted) { |         if (this.noteContext | ||||||
|  |             && this.noteContext.notePath | ||||||
|  |             && !this.noteContext.note.isDeleted | ||||||
|  |             && !this.noteContext.notePath.includes("root/hidden") | ||||||
|  |         ) { | ||||||
|             const newActiveNode = await this.getNodeFromPath(this.noteContext.notePath); |             const newActiveNode = await this.getNodeFromPath(this.noteContext.notePath); | ||||||
| 
 | 
 | ||||||
|             if (newActiveNode) { |             if (newActiveNode) { | ||||||
| @ -1158,9 +1166,11 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | |||||||
|         if (activeNotePath) { |         if (activeNotePath) { | ||||||
|             const node = await this.getNodeFromPath(activeNotePath, true); |             const node = await this.getNodeFromPath(activeNotePath, true); | ||||||
| 
 | 
 | ||||||
|  |             if (node) { | ||||||
|                 await node.setActive(true, {noEvents: true, noFocus: true}); |                 await node.setActive(true, {noEvents: true, noFocus: true}); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     async hoistedNoteChangedEvent({ntxId}) { |     async hoistedNoteChangedEvent({ntxId}) { | ||||||
|         if (this.isNoteContext(ntxId)) { |         if (this.isNoteContext(ntxId)) { | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ const dateUtils = require('../../services/date_utils'); | |||||||
| const noteService = require('../../services/notes'); | const noteService = require('../../services/notes'); | ||||||
| const attributeService = require('../../services/attributes'); | const attributeService = require('../../services/attributes'); | ||||||
| const cls = require('../../services/cls'); | const cls = require('../../services/cls'); | ||||||
|  | const becca = require('../../becca/becca'); | ||||||
| 
 | 
 | ||||||
| function getInboxNote(req) { | function getInboxNote(req) { | ||||||
|     const hoistedNote = getHoistedNote(); |     const hoistedNote = getHoistedNote(); | ||||||
| @ -79,6 +80,40 @@ function createSqlConsole() { | |||||||
|     return note; |     return note; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | function getHiddenRoot() { | ||||||
|  |     let hidden = becca.getNote('hidden'); | ||||||
|  | 
 | ||||||
|  |     if (!hidden) { | ||||||
|  |         hidden = noteService.createNewNote({ | ||||||
|  |             noteId: 'hidden', | ||||||
|  |             title: 'hidden', | ||||||
|  |             type: 'text', | ||||||
|  |             content: '', | ||||||
|  |             parentNoteId: 'root' | ||||||
|  |         }).note; | ||||||
|  | 
 | ||||||
|  |         hidden.addLabel('archived', "", true); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return hidden; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function getSearchRoot() { | ||||||
|  |     let searchRoot = becca.getNote('search'); | ||||||
|  | 
 | ||||||
|  |     if (!searchRoot) { | ||||||
|  |         searchRoot = noteService.createNewNote({ | ||||||
|  |             noteId: 'search', | ||||||
|  |             title: 'search', | ||||||
|  |             type: 'text', | ||||||
|  |             content: '', | ||||||
|  |             parentNoteId: getHiddenRoot().noteId | ||||||
|  |         }).note; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return searchRoot; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function createSearchNote(req) { | function createSearchNote(req) { | ||||||
|     const params = req.body; |     const params = req.body; | ||||||
|     const searchString = params.searchString || ""; |     const searchString = params.searchString || ""; | ||||||
| @ -86,29 +121,29 @@ function createSearchNote(req) { | |||||||
| 
 | 
 | ||||||
|     const hoistedNote = getHoistedNote(); |     const hoistedNote = getHoistedNote(); | ||||||
| 
 | 
 | ||||||
|     let searchHome; |     let searchHome = getSearchRoot(); | ||||||
| 
 | 
 | ||||||
|     if (hoistedNote) { |     // if (hoistedNote) {
 | ||||||
|         ([searchHome] = hoistedNote.getDescendantNotesWithLabel('hoistedSearchHome')); |     //     ([searchHome] = hoistedNote.getDescendantNotesWithLabel('hoistedSearchHome'));
 | ||||||
| 
 |     //
 | ||||||
|         if (!searchHome) { |     //     if (!searchHome) {
 | ||||||
|             ([searchHome] = hoistedNote.getDescendantNotesWithLabel('searchHome')); |     //         ([searchHome] = hoistedNote.getDescendantNotesWithLabel('searchHome'));
 | ||||||
|         } |     //     }
 | ||||||
| 
 |     //
 | ||||||
|         if (!searchHome) { |     //     if (!searchHome) {
 | ||||||
|             searchHome = hoistedNote; |     //         searchHome = hoistedNote;
 | ||||||
|         } |     //     }
 | ||||||
| 
 |     //
 | ||||||
|         if (!ancestorNoteId) { |     //     if (!ancestorNoteId) {
 | ||||||
|             ancestorNoteId = hoistedNote.noteId; |     //         ancestorNoteId = hoistedNote.noteId;
 | ||||||
|         } |     //     }
 | ||||||
|     } |     // }
 | ||||||
|     else { |     // else {
 | ||||||
|         const today = dateUtils.localNowDate(); |     //     const today = dateUtils.localNowDate();
 | ||||||
| 
 |     //
 | ||||||
|         searchHome = attributeService.getNoteWithLabel('searchHome') |     //     searchHome = attributeService.getNoteWithLabel('searchHome')
 | ||||||
|                   || dateNoteService.getDateNote(today); |     //               || dateNoteService.getDateNote(today);
 | ||||||
|     } |     // }
 | ||||||
| 
 | 
 | ||||||
|     const {note} = noteService.createNewNote({ |     const {note} = noteService.createNewNote({ | ||||||
|         parentNoteId: searchHome.noteId, |         parentNoteId: searchHome.noteId, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam