From dff2d3e9894385004c6c5063c70ff2bf6e81004e Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 2 Aug 2022 17:01:09 +0200 Subject: [PATCH] launchbar WIP --- src/services/special_notes.js | 65 +++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/services/special_notes.js b/src/services/special_notes.js index ebe447d98..88ce3f8a9 100644 --- a/src/services/special_notes.js +++ b/src/services/special_notes.js @@ -236,11 +236,76 @@ function getBulkActionNote() { return bulkActionNote; } +function getLaunchBarRoot() { + let note = becca.getNote('launchbar'); + + if (!note) { + note = noteService.createNewNote({ + branchId: 'launchbar', + noteId: 'launchbar', + title: 'Launch bar', + type: 'text', + content: '', + parentNoteId: getHiddenRoot().noteId + }).note; + } + + return note; +} + +function getLaunchBarAvailableShortcutsRoot() { + let note = becca.getNote('lb_availableshortcuts'); + + if (!note) { + note = noteService.createNewNote({ + branchId: 'lb_availableshortcuts', + noteId: 'lb_availableshortcuts', + title: 'Available shortcuts', + type: 'text', + content: '', + parentNoteId: getLaunchBarRoot().noteId + }).note; + } + + return note; +} + +function getLaunchBarVisibleShortcutsRoot() { + let note = becca.getNote('lb_visibleshortcuts'); + + if (!note) { + note = noteService.createNewNote({ + branchId: 'lb_visibleshortcuts', + noteId: 'lb_visibleshortcuts', + title: 'Visible shortcuts', + type: 'text', + content: '', + parentNoteId: getLaunchBarRoot().noteId + }).note; + } + + return note; +} + +const shortcuts = [ + { id: 'lb_newnote', command: 'createNoteIntoInbox', title: 'New note', icon: 'bx bx-file-blank' }, + { id: 'lb_searcj', command: 'searchNotes', title: 'Search notes', icon: 'bx bx-search' }, + { id: 'lb_jumpto', command: 'jumpToNote', title: 'Jump to note', icon: 'bx bx-send' }, + { id: 'lb_notemap', targetNote: 'globalnotemap', title: 'Note map', icon: 'bx bx-map' }, + { id: 'lb_recentchanges', command: 'showRecentChanges', title: 'Show recent changes', icon: 'bx bx-history' }, + { id: 'lb_recentchanges', command: 'jumpToNote', title: 'Jump to note', icon: 'bx bx-send' }, + +]; + function createMissingSpecialNotes() { getSinglesNoteRoot(); getSqlConsoleRoot(); getGlobalNoteMap(); getBulkActionNote(); + getLaunchBarRoot(); + getLaunchBarAvailableShortcutsRoot(); + getLaunchBarVisibleShortcutsRoot(); + // share root is not automatically created since it's visible in the tree and many won't need it/use it const hidden = getHiddenRoot();