mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 04:16:17 +01:00 
			
		
		
		
	launchbar WIP
This commit is contained in:
		@@ -77,9 +77,9 @@ export default class ShortcutContainer extends FlexContainer {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    entitiesReloadedEvent({loadResults}) {
 | 
					    entitiesReloadedEvent({loadResults}) {
 | 
				
			||||||
        if (loadResults.getNoteIds().find(noteId => noteId.startsWith("lb_"))
 | 
					        if (loadResults.getNoteIds().find(noteId => froca.notes[noteId]?.isLaunchBarConfig())
 | 
				
			||||||
            || loadResults.getBranches().find(branch => branch.branchId.startsWith("lb_"))
 | 
					            || loadResults.getBranches().find(branch => branch.parentNoteId.startsWith("lb_"))
 | 
				
			||||||
            || loadResults.getAttributes().find(attr => attr.noteId.startsWith("lb_"))) {
 | 
					            || loadResults.getAttributes().find(attr => froca.notes[attr.noteId]?.isLaunchBarConfig())) {
 | 
				
			||||||
            this.load();
 | 
					            this.load();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1535,5 +1535,9 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
 | 
				
			|||||||
        if (!resp.success) {
 | 
					        if (!resp.success) {
 | 
				
			||||||
            alert(resp.message);
 | 
					            alert(resp.message);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        await ws.waitForMaxKnownEntityChangeId();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        appContext.tabManager.getActiveContext().setNote(resp.note.noteId);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -383,9 +383,48 @@ function createMissingSpecialNotes() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function createShortcut(parentNoteId, type) {
 | 
					function createShortcut(parentNoteId, type) {
 | 
				
			||||||
    if (type === 'note') {
 | 
					    let note;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (type === 'note') {
 | 
				
			||||||
 | 
					        note = noteService.createNewNote({
 | 
				
			||||||
 | 
					            title: "Note shortcut",
 | 
				
			||||||
 | 
					            type: 'shortcut',
 | 
				
			||||||
 | 
					            content: '',
 | 
				
			||||||
 | 
					            parentNoteId: parentNoteId
 | 
				
			||||||
 | 
					        }).note;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        note.addLabel('relation:targetNote', 'promoted');
 | 
				
			||||||
 | 
					    } else if (type === 'widget') {
 | 
				
			||||||
 | 
					        note = noteService.createNewNote({
 | 
				
			||||||
 | 
					            title: "Widget shortcut",
 | 
				
			||||||
 | 
					            type: 'shortcut',
 | 
				
			||||||
 | 
					            content: '',
 | 
				
			||||||
 | 
					            parentNoteId: parentNoteId
 | 
				
			||||||
 | 
					        }).note;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        note.addLabel('relation:widget', 'promoted');
 | 
				
			||||||
 | 
					    } else if (type === 'spacer') {
 | 
				
			||||||
 | 
					        note = noteService.createNewNote({
 | 
				
			||||||
 | 
					            title: "Spacer",
 | 
				
			||||||
 | 
					            type: 'shortcut',
 | 
				
			||||||
 | 
					            content: '',
 | 
				
			||||||
 | 
					            parentNoteId: parentNoteId
 | 
				
			||||||
 | 
					        }).note;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        note.addLabel('builtinWidget', 'spacer');
 | 
				
			||||||
 | 
					        note.addLabel('iconClass', 'bx bx-move-vertical');
 | 
				
			||||||
 | 
					        note.addLabel('label:baseSize', 'promoted,number');
 | 
				
			||||||
 | 
					        note.addLabel('baseSize', '40');
 | 
				
			||||||
 | 
					        note.addLabel('label:growthFactor', 'promoted,number');
 | 
				
			||||||
 | 
					        note.addLabel('growthFactor', '0');
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        throw new Error(`Unrecognized shortcut type ${type}`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					        success: true,
 | 
				
			||||||
 | 
					        note
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user