mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	search fixes
This commit is contained in:
		
							parent
							
								
									ec351137d4
								
							
						
					
					
						commit
						8b0a1e546d
					
				
							
								
								
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -2634,9 +2634,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "electron": {
 | 
					    "electron": {
 | 
				
			||||||
      "version": "9.4.1",
 | 
					      "version": "11.2.1",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/electron/-/electron-9.4.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/electron/-/electron-11.2.1.tgz",
 | 
				
			||||||
      "integrity": "sha512-r4CxoVG9Ja7tBtkilWMnBsBGup8G8Z+v7icZmwysHa8/OSr0OrLjrcOF/30BAP7yPE5fz/XTxygnltzW4OTZdw==",
 | 
					      "integrity": "sha512-Im1y29Bnil+Nzs+FCTq01J1OtLbs+2ZGLLllaqX/9n5GgpdtDmZhS/++JHBsYZ+4+0n7asO+JKQgJD+CqPClzg==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "@electron/get": "^1.0.1",
 | 
					        "@electron/get": "^1.0.1",
 | 
				
			||||||
 | 
				
			|||||||
@ -77,7 +77,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "cross-env": "7.0.3",
 | 
					    "cross-env": "7.0.3",
 | 
				
			||||||
    "electron": "9.4.1",
 | 
					    "electron": "11.2.1",
 | 
				
			||||||
    "electron-builder": "22.9.1",
 | 
					    "electron-builder": "22.9.1",
 | 
				
			||||||
    "electron-packager": "15.2.0",
 | 
					    "electron-packager": "15.2.0",
 | 
				
			||||||
    "electron-rebuild": "2.3.4",
 | 
					    "electron-rebuild": "2.3.4",
 | 
				
			||||||
 | 
				
			|||||||
@ -104,7 +104,7 @@ function getSomeNotePath(note) {
 | 
				
			|||||||
    while (cur.noteId !== 'root') {
 | 
					    while (cur.noteId !== 'root') {
 | 
				
			||||||
        path.push(cur.noteId);
 | 
					        path.push(cur.noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const parents = cur.getParentNotes();
 | 
					        const parents = cur.getParentNotes().filter(note => note.type !== 'search');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!parents.length) {
 | 
					        if (!parents.length) {
 | 
				
			||||||
            logError(`Can't find parents for note ${cur.noteId}`);
 | 
					            logError(`Can't find parents for note ${cur.noteId}`);
 | 
				
			||||||
 | 
				
			|||||||
@ -185,6 +185,8 @@ const TPL = `
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
`;
 | 
					`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const MAX_SEARCH_RESULTS_IN_TREE = 100;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class NoteTreeWidget extends TabAwareWidget {
 | 
					export default class NoteTreeWidget extends TabAwareWidget {
 | 
				
			||||||
    constructor(treeName) {
 | 
					    constructor(treeName) {
 | 
				
			||||||
        super();
 | 
					        super();
 | 
				
			||||||
@ -480,9 +482,19 @@ export default class NoteTreeWidget extends TabAwareWidget {
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    data.result = treeCache.reloadNotes([noteId]).then(() => {
 | 
					                    data.result = treeCache.reloadNotes([noteId]).then(() => {
 | 
				
			||||||
                       const note = treeCache.getNoteFromCache(noteId);
 | 
					                        const note = treeCache.getNoteFromCache(noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                       return this.prepareChildren(note);
 | 
					                        let childNoteIds = note.getChildNoteIds();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        if (childNoteIds.length > MAX_SEARCH_RESULTS_IN_TREE) {
 | 
				
			||||||
 | 
					                            childNoteIds = childNoteIds.slice(0, MAX_SEARCH_RESULTS_IN_TREE);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        return treeCache.getNotes(childNoteIds);
 | 
				
			||||||
 | 
					                    }).then(() => {
 | 
				
			||||||
 | 
					                        const note = treeCache.getNoteFromCache(noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        return this.prepareChildren(note);
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else {
 | 
					                else {
 | 
				
			||||||
@ -494,6 +506,13 @@ export default class NoteTreeWidget extends TabAwareWidget {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            enhanceTitle: async function (event, data) {
 | 
					            enhanceTitle: async function (event, data) {
 | 
				
			||||||
                const node = data.node;
 | 
					                const node = data.node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (!node.data.noteId) {
 | 
				
			||||||
 | 
					                    // if there's "non-note" node, then don't enhance
 | 
				
			||||||
 | 
					                    // this can happen for e.g. "Load error!" node
 | 
				
			||||||
 | 
					                    return;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                const $span = $(node.span);
 | 
					                const $span = $(node.span);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $span.find('.tree-item-button').remove();
 | 
					                $span.find('.tree-item-button').remove();
 | 
				
			||||||
@ -572,7 +591,13 @@ export default class NoteTreeWidget extends TabAwareWidget {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        const hideArchivedNotes = this.hideArchivedNotes;
 | 
					        const hideArchivedNotes = this.hideArchivedNotes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (const branch of this.getChildBranches(parentNote)) {
 | 
					        let childBranches = this.getChildBranches(parentNote);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (childBranches.length > MAX_SEARCH_RESULTS_IN_TREE) {
 | 
				
			||||||
 | 
					            childBranches = childBranches.slice(0, MAX_SEARCH_RESULTS_IN_TREE);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        for (const branch of childBranches) {
 | 
				
			||||||
            if (hideArchivedNotes) {
 | 
					            if (hideArchivedNotes) {
 | 
				
			||||||
                const note = branch.getNoteFromCache();
 | 
					                const note = branch.getNoteFromCache();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user