mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	add possibility to define search home for hoisted notes, #1694
This commit is contained in:
		
							parent
							
								
									2c755bcc38
								
							
						
					
					
						commit
						cb91dadeca
					
				@ -66,14 +66,22 @@ function createSearchNote(req) {
 | 
				
			|||||||
    const searchString = params.searchString || "";
 | 
					    const searchString = params.searchString || "";
 | 
				
			||||||
    let ancestorNoteId = params.ancestorNoteId;
 | 
					    let ancestorNoteId = params.ancestorNoteId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const today = dateUtils.localNowDate();
 | 
					    const hoistedNote = cls.getHoistedNoteId() ? repository.getNote(cls.getHoistedNoteId()) : null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let searchHome =
 | 
					    let searchHome;
 | 
				
			||||||
        attributeService.getNoteWithLabel('searchHome')
 | 
					 | 
				
			||||||
        || dateNoteService.getDateNote(today);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (cls.getHoistedNoteId() && cls.getHoistedNoteId() !== 'root') {
 | 
					    if (hoistedNote) {
 | 
				
			||||||
        const hoistedNote = repository.getNote(cls.getHoistedNoteId());
 | 
					        ([searchHome] = hoistedNote.getDescendantNotesWithLabel('hoistedSearchHome'));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!searchHome) {
 | 
				
			||||||
 | 
					        const today = dateUtils.localNowDate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        searchHome = attributeService.getNoteWithLabel('searchHome')
 | 
				
			||||||
 | 
					                  || dateNoteService.getDateNote(today);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (hoistedNote && hoistedNote.noteId !== 'root') {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!hoistedNote.getDescendantNoteIds().includes(searchHome.noteId)) {
 | 
					        if (!hoistedNote.getDescendantNoteIds().includes(searchHome.noteId)) {
 | 
				
			||||||
            // otherwise the note would be saved outside of the hoisted context which is weird
 | 
					            // otherwise the note would be saved outside of the hoisted context which is weird
 | 
				
			||||||
@ -81,7 +89,7 @@ function createSearchNote(req) {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!ancestorNoteId) {
 | 
					        if (!ancestorNoteId) {
 | 
				
			||||||
            ancestorNoteId = cls.getHoistedNoteId();
 | 
					            ancestorNoteId = hoistedNote.noteId;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -38,6 +38,7 @@ const BUILTIN_ATTRIBUTES = [
 | 
				
			|||||||
    { type: 'label', name: 'workspaceIconClass' },
 | 
					    { type: 'label', name: 'workspaceIconClass' },
 | 
				
			||||||
    { type: 'label', name: 'workspaceTabBackgroundColor' },
 | 
					    { type: 'label', name: 'workspaceTabBackgroundColor' },
 | 
				
			||||||
    { type: 'label', name: 'searchHome' },
 | 
					    { type: 'label', name: 'searchHome' },
 | 
				
			||||||
 | 
					    { type: 'label', name: 'hoistedSearchHome' },
 | 
				
			||||||
    { type: 'label', name: 'sqlConsoleHome' },
 | 
					    { type: 'label', name: 'sqlConsoleHome' },
 | 
				
			||||||
    { type: 'label', name: 'datePattern' },
 | 
					    { type: 'label', name: 'datePattern' },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user