mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	improvements
This commit is contained in:
		
							parent
							
								
									b9632a7814
								
							
						
					
					
						commit
						5fc9f5f3f9
					
				| @ -8,7 +8,7 @@ module.exports = () => { | ||||
|         beccaLoader.load(); | ||||
| 
 | ||||
|         for (const attr of becca.findAttributes('label','bookmarked')) { | ||||
|             cloningService.toggleNoteInParent(true, attr.noteId, 'lb_bookmarks'); | ||||
|             cloningService.toggleNoteInParent(true, attr.noteId, 'lbBookmarks'); | ||||
| 
 | ||||
|             attr.markAsDeleted("0204__migrate_bookmarks_to_clones"); | ||||
|         } | ||||
|  | ||||
| @ -6,6 +6,10 @@ UPDATE branches SET branchId = 'globalNoteMap' WHERE branchId = 'globalnotemap'; | ||||
| UPDATE branches SET branchId = 'bulkAction' WHERE branchId = 'bulkaction'; | ||||
| UPDATE branches SET branchId = 'sqlConsole' WHERE branchId = 'sqlconsole'; | ||||
| 
 | ||||
| UPDATE branches SET noteId = 'globalNoteMap' WHERE noteId = 'globalnotemap'; | ||||
| UPDATE branches SET noteId = 'bulkAction' WHERE noteId = 'bulkaction'; | ||||
| UPDATE branches SET noteId = 'sqlConsole' WHERE noteId = 'sqlconsole'; | ||||
| 
 | ||||
| UPDATE branches SET parentNoteId = 'globalNoteMap' WHERE parentNoteId = 'globalnotemap'; | ||||
| UPDATE branches SET parentNoteId = 'bulkAction' WHERE parentNoteId = 'bulkaction'; | ||||
| UPDATE branches SET parentNoteId = 'sqlConsole' WHERE parentNoteId = 'sqlconsole'; | ||||
| @ -13,3 +17,11 @@ UPDATE branches SET parentNoteId = 'sqlConsole' WHERE parentNoteId = 'sqlconsole | ||||
| UPDATE attributes SET noteId = 'globalNoteMap' WHERE noteId = 'globalnotemap'; | ||||
| UPDATE attributes SET noteId = 'bulkAction' WHERE noteId = 'bulkaction'; | ||||
| UPDATE attributes SET noteId = 'sqlConsole' WHERE noteId = 'sqlconsole'; | ||||
| 
 | ||||
| UPDATE attributes SET value = 'globalNoteMap' WHERE type = 'relation' AND value = 'globalnotemap'; | ||||
| UPDATE attributes SET value = 'bulkAction' WHERE type = 'relation' AND value = 'bulkaction'; | ||||
| UPDATE attributes SET value = 'sqlConsole' WHERE type = 'relation' AND value = 'sqlconsole'; | ||||
| 
 | ||||
| UPDATE entity_changes SET entityId = 'globalNoteMap' WHERE entityId = 'globalnotemap'; | ||||
| UPDATE entity_changes SET entityId = 'bulkAction' WHERE entityId = 'bulkaction'; | ||||
| UPDATE entity_changes SET entityId = 'sqlConsole' WHERE entityId = 'sqlconsole'; | ||||
|  | ||||
| @ -129,7 +129,7 @@ class Branch extends AbstractEntity { | ||||
|      * @returns {boolean} | ||||
|      */ | ||||
|     get isWeak() { | ||||
|         return ['share', 'lb_bookmarks'].includes(this.parentNoteId); | ||||
|         return ['share', 'lbBookmarks'].includes(this.parentNoteId); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -1328,6 +1328,10 @@ class Note extends AbstractEntity { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     isLaunchBarConfig() { | ||||
|         return this.type === 'launcher' || ['lbRoot', 'lbAvailableShortcuts', 'lbVisibleShortcuts']; | ||||
|     } | ||||
| 
 | ||||
|     get isDeleted() { | ||||
|         return !(this.noteId in this.becca.notes) || this.isBeingDeleted; | ||||
|     } | ||||
|  | ||||
| @ -73,7 +73,7 @@ export default class RootCommandExecutor extends Component { | ||||
|     } | ||||
| 
 | ||||
|     async showLaunchBarSubtreeCommand() { | ||||
|         await appContext.tabManager.openContextWithNote('lb_root', true, null, 'lb_root'); | ||||
|         await appContext.tabManager.openContextWithNote('lbRoot', true, null, 'lbRoot'); | ||||
|     } | ||||
| 
 | ||||
|     async showShareSubtreeCommand() { | ||||
|  | ||||
| @ -828,7 +828,7 @@ class NoteShort { | ||||
|     } | ||||
| 
 | ||||
|     isLaunchBarConfig() { | ||||
|         return this.type === 'launcher' || this.noteId.startsWith("lb_"); | ||||
|         return this.type === 'launcher' || ['lbRoot', 'lbAvailableShortcuts', 'lbVisibleShortcuts']; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -27,13 +27,13 @@ export default class LauncherContextMenu { | ||||
|         const note = await froca.getNote(this.node.data.noteId); | ||||
|         const parentNoteId = this.node.getParent().data.noteId; | ||||
| 
 | ||||
|         const isVisibleRoot = note.noteId === 'lb_visiblelaunchers'; | ||||
|         const isAvailableRoot = note.noteId === 'lb_availablelaunchers'; | ||||
|         const isVisibleItem = parentNoteId === 'lb_visiblelaunchers'; | ||||
|         const isAvailableItem = parentNoteId === 'lb_availablelaunchers'; | ||||
|         const isVisibleRoot = note.noteId === 'lbVisibleLaunchers'; | ||||
|         const isAvailableRoot = note.noteId === 'lbAvailableLaunchers'; | ||||
|         const isVisibleItem = parentNoteId === 'lbVisibleLaunchers'; | ||||
|         const isAvailableItem = parentNoteId === 'lbAvailableLaunchers'; | ||||
|         const isItem = isVisibleItem || isAvailableItem; | ||||
|         const canBeDeleted = !note.noteId.startsWith("lb_"); | ||||
|         const canBeReset = note.noteId.startsWith("lb_"); | ||||
|         const canBeDeleted = !note.isLaunchBarConfig(); | ||||
|         const canBeReset = note.isLaunchBarConfig(); | ||||
| 
 | ||||
|         return [ | ||||
|             (isVisibleRoot || isAvailableRoot) ? { title: 'Add a note launcher', command: 'addNoteLauncher', uiIcon: "bx bx-plus" } : null, | ||||
|  | ||||
| @ -10,7 +10,7 @@ async function moveBeforeBranch(branchIdsToMove, beforeBranchId) { | ||||
|     branchIdsToMove = filterRootNote(branchIdsToMove); | ||||
|     branchIdsToMove = filterSearchBranches(branchIdsToMove); | ||||
| 
 | ||||
|     if (['root', 'lb_root', 'lb_availablelaunchers', 'lb_visiblelaunchers'].includes(beforeBranchId)) { | ||||
|     if (['root', 'lbRoot', 'lbAvailableLaunchers', 'lbVisibleLaunchers'].includes(beforeBranchId)) { | ||||
|         toastService.showError('Cannot move notes here.'); | ||||
|         return; | ||||
|     } | ||||
| @ -34,9 +34,9 @@ async function moveAfterBranch(branchIdsToMove, afterBranchId) { | ||||
|     const forbiddenNoteIds = [ | ||||
|         'root', | ||||
|         hoistedNoteService.getHoistedNoteId(), | ||||
|         'lb_root', | ||||
|         'lb_availablelaunchers', | ||||
|         'lb_visiblelaunchers' | ||||
|         'lbRoot', | ||||
|         'lbAvailableLaunchers', | ||||
|         'lbVisibleLaunchers' | ||||
|     ]; | ||||
| 
 | ||||
|     if (forbiddenNoteIds.includes(afterNote.noteId)) { | ||||
| @ -57,7 +57,7 @@ async function moveAfterBranch(branchIdsToMove, afterBranchId) { | ||||
| } | ||||
| 
 | ||||
| async function moveToParentNote(branchIdsToMove, newParentBranchId) { | ||||
|     if (newParentBranchId === 'lb_root') { | ||||
|     if (newParentBranchId === 'lbRoot') { | ||||
|         toastService.showError('Cannot move notes here.'); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
| @ -15,7 +15,7 @@ export default class BookmarkButtons extends FlexContainer { | ||||
|         this.children = []; | ||||
|         this.noteIds = []; | ||||
| 
 | ||||
|         const bookmarkParentNote = await froca.getNote('lb_bookmarks'); | ||||
|         const bookmarkParentNote = await froca.getNote('lbBookmarks'); | ||||
| 
 | ||||
|         for (const note of await bookmarkParentNote.getChildNotes()) { | ||||
|             this.noteIds.push(note.noteId); | ||||
| @ -37,7 +37,7 @@ export default class BookmarkButtons extends FlexContainer { | ||||
|     } | ||||
| 
 | ||||
|     entitiesReloadedEvent({loadResults}) { | ||||
|         if (loadResults.getBranches().find(branch => branch.parentNoteId === 'lb_bookmarks')) { | ||||
|         if (loadResults.getBranches().find(branch => branch.parentNoteId === 'lbBookmarks')) { | ||||
|             this.refresh(); | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -20,7 +20,7 @@ export default class BookmarkSwitchWidget extends SwitchWidget { | ||||
|     } | ||||
| 
 | ||||
|     async toggle(state) { | ||||
|         const resp = await server.put(`notes/${this.noteId}/toggle-in-parent/lb_bookmarks/` + !!state); | ||||
|         const resp = await server.put(`notes/${this.noteId}/toggle-in-parent/lbBookmarks/` + !!state); | ||||
| 
 | ||||
|         if (!resp.success) { | ||||
|             toastService.showError(resp.message); | ||||
| @ -28,7 +28,7 @@ export default class BookmarkSwitchWidget extends SwitchWidget { | ||||
|     } | ||||
| 
 | ||||
|     refreshWithNote(note) { | ||||
|         const isBookmarked = !!note.getParentBranches().find(b => b.parentNoteId === 'lb_bookmarks'); | ||||
|         const isBookmarked = !!note.getParentBranches().find(b => b.parentNoteId === 'lbBookmarks'); | ||||
| 
 | ||||
|         this.$switchOn.toggle(!isBookmarked); | ||||
|         this.$switchOff.toggle(isBookmarked); | ||||
|  | ||||
| @ -8,7 +8,7 @@ export default class BackInHistoryButtonWidget extends AbstractHistoryNavigation | ||||
|             .title("Go to previous note.") | ||||
|             .command("backInNoteHistory") | ||||
|             .titlePlacement("right") | ||||
|             .buttonNoteIdProvider(() => 'lb_backinhistory') | ||||
|             .buttonNoteIdProvider(() => 'lbBackInHistory') | ||||
|             .onContextMenu(e => this.showContextMenu(e)); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -8,7 +8,7 @@ export default class ForwardInHistoryButtonWidget extends AbstractHistoryNavigat | ||||
|             .title("Go to next note.") | ||||
|             .command("forwardInNoteHistory") | ||||
|             .titlePlacement("right") | ||||
|             .buttonNoteIdProvider(() => 'lb_forwardinhistory') | ||||
|             .buttonNoteIdProvider(() => 'lbForwardInHistory') | ||||
|             .onContextMenu(e => this.showContextMenu(e)); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -38,7 +38,7 @@ const TPL = ` | ||||
| 
 | ||||
| export default class NoteActionsWidget extends NoteContextAwareWidget { | ||||
|     isEnabled() { | ||||
|         return !this.note?.isLaunchBarConfig(); | ||||
|         return this.note?.type !== 'launcher'; | ||||
|     } | ||||
| 
 | ||||
|     doRender() { | ||||
|  | ||||
| @ -17,7 +17,7 @@ export default class LauncherContainer extends FlexContainer { | ||||
|     async load() { | ||||
|         this.children = []; | ||||
| 
 | ||||
|         const visibleLaunchersRoot = await froca.getNote('lb_visiblelaunchers', true); | ||||
|         const visibleLaunchersRoot = await froca.getNote('lbVisibleLaunchers', true); | ||||
| 
 | ||||
|         if (!visibleLaunchersRoot) { | ||||
|             console.log("Visible launchers root note doesn't exist."); | ||||
| @ -61,7 +61,7 @@ export default class LauncherContainer extends FlexContainer { | ||||
|     } | ||||
| 
 | ||||
|     entitiesReloadedEvent({loadResults}) { | ||||
|         if (loadResults.getBranches().find(branch => branch.parentNoteId.startsWith("lb_"))) { | ||||
|         if (loadResults.getBranches().find(branch => froca.getNoteFromCache(branch.parentNoteId)?.isLaunchBarConfig())) { | ||||
|             // changes in note placement requires reload of all launchers, all other changes are handled by individual
 | ||||
|             // launchers
 | ||||
|             this.load(); | ||||
|  | ||||
| @ -58,7 +58,7 @@ const typeWidgetClasses = { | ||||
|     'canvas': CanvasTypeWidget, | ||||
|     'protectedSession': ProtectedSessionTypeWidget, | ||||
|     'book': BookTypeWidget, | ||||
|     'note-map': NoteMapTypeWidget, | ||||
|     'noteMap': NoteMapTypeWidget, | ||||
|     'webView': WebViewTypeWidget, | ||||
|     'doc': DocTypeWidget, | ||||
|     'contentWidget': ContentWidgetTypeWidget | ||||
|  | ||||
| @ -73,7 +73,7 @@ export default class NoteTitleWidget extends NoteContextAwareWidget { | ||||
|         this.$noteTitle.val(note.title); | ||||
| 
 | ||||
|         this.$noteTitle.prop("readonly", (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) | ||||
|                                         || ["lb_root", "lb_availablelaunchers", "lb_visiblelaunchers"].includes(note.noteId)); | ||||
|                                         || ["lbRoot", "lbAvailableLaunchers", "lbVisibleLaunchers"].includes(note.noteId)); | ||||
| 
 | ||||
|         this.setProtectedStatus(note); | ||||
|     } | ||||
|  | ||||
| @ -398,7 +398,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | ||||
|                 autoExpandMS: 600, | ||||
|                 preventLazyParents: false, | ||||
|                 dragStart: (node, data) => { | ||||
|                     if (['root', 'hidden', 'lb_root', 'lb_availablelaunchers', 'lb_visiblelaunchers'].includes(node.data.noteId)) { | ||||
|                     if (['root', 'hidden', 'lbRoot', 'lbAvailableLaunchers', 'lbVisibleLaunchers'].includes(node.data.noteId)) { | ||||
|                         return false; | ||||
|                     } | ||||
| 
 | ||||
| @ -426,7 +426,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | ||||
|                 dragEnter: (node, data) => { | ||||
|                     if (node.data.noteType === 'search') { | ||||
|                         return false; | ||||
|                     } else if (node.data.noteId === 'lb_root') { | ||||
|                     } else if (node.data.noteId === 'lbRoot') { | ||||
|                         return false; | ||||
|                     } else if (node.data.noteType === 'launcher') { | ||||
|                         return ['before', 'after']; | ||||
| @ -604,7 +604,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | ||||
|         this.$tree.on('contextmenu', '.fancytree-node', e => { | ||||
|             const node = $.ui.fancytree.getNode(e); | ||||
| 
 | ||||
|             if (hoistedNoteService.getHoistedNoteId() === 'lb_root') { | ||||
|             if (hoistedNoteService.getHoistedNoteId() === 'lbRoot') { | ||||
|                 import("../menus/launcher_context_menu.js").then(({LauncherContextMenu: ShortcutContextMenu}) => { | ||||
|                     const shortcutContextMenu = new LauncherContextMenu(this, node); | ||||
|                     shortcutContextMenu.show(e); | ||||
| @ -744,7 +744,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | ||||
|                 .map(noteId => froca.notes[noteId]) | ||||
|                 .filter(note => !!note) | ||||
|                 .filter(note => | ||||
|                     !['share', 'lb_bookmarks'].includes(note.noteId) | ||||
|                     !['share', 'lbBookmarks'].includes(note.noteId) | ||||
|                     && note.type !== 'search'); | ||||
| 
 | ||||
|             if (realClones.length > 1) { | ||||
| @ -1554,11 +1554,11 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | ||||
|     } | ||||
| 
 | ||||
|     moveShortcutToVisibleCommand({node, selectedOrActiveBranchIds}) { | ||||
|         branchService.moveToParentNote(selectedOrActiveBranchIds, 'lb_visiblelaunchers'); | ||||
|         branchService.moveToParentNote(selectedOrActiveBranchIds, 'lbVisibleLaunchers'); | ||||
|     } | ||||
| 
 | ||||
|     moveShortcutToAvailableCommand({node, selectedOrActiveBranchIds}) { | ||||
|         branchService.moveToParentNote(selectedOrActiveBranchIds, 'lb_availablelaunchers'); | ||||
|         branchService.moveToParentNote(selectedOrActiveBranchIds, 'lbAvailableLaunchers'); | ||||
|     } | ||||
| 
 | ||||
|     addNoteLauncherCommand({node}) { | ||||
|  | ||||
| @ -47,7 +47,7 @@ export default class OwnedAttributeListWidget extends NoteContextAwareWidget { | ||||
| 
 | ||||
|     getTitle() { | ||||
|         return { | ||||
|             show: true,//!this.note.isLaunchBarConfig(),
 | ||||
|             show: !this.note.isLaunchBarConfig(), | ||||
|             title: "Owned attributes", | ||||
|             icon: "bx bx-list-check" | ||||
|         }; | ||||
|  | ||||
| @ -162,8 +162,6 @@ eventService.subscribe(eventService.ENTITY_CHANGED, ({ entityName, entity }) => | ||||
|     }); | ||||
| }); | ||||
| 
 | ||||
| const debouncedCreateMissingSpecialNotes = debounce(() => specialNotesService.createMissingSpecialNotes(), 300); | ||||
| 
 | ||||
| eventService.subscribe(eventService.ENTITY_DELETED, ({ entityName, entity }) => { | ||||
|     processInverseRelations(entityName, entity, (definition, note, targetNote) => { | ||||
|         // if one inverse attribute is deleted then the other should be deleted as well
 | ||||
| @ -179,13 +177,6 @@ eventService.subscribe(eventService.ENTITY_DELETED, ({ entityName, entity }) => | ||||
|     if (entityName === 'branches') { | ||||
|         runAttachedRelations(entity.getNote(), 'runOnBranchDeletion', entity); | ||||
|     } | ||||
| 
 | ||||
|     if (entityName === 'notes') { | ||||
|         if (entity.noteId.startsWith("lb_")) { | ||||
|             // if user deletes shortcuts, restore them immediately
 | ||||
|             debouncedCreateMissingSpecialNotes(); | ||||
|         } | ||||
|     } | ||||
| }); | ||||
| 
 | ||||
| module.exports = { | ||||
|  | ||||
| @ -114,11 +114,11 @@ function getAndValidateParent(params) { | ||||
|         throw new Error(`Launchers should not have child notes.`); | ||||
|     } | ||||
| 
 | ||||
|     if (!params.ignoreForbiddenParents && ['lb_root'].includes(parentNote.noteId)) { | ||||
|     if (!params.ignoreForbiddenParents && ['lbRoot'].includes(parentNote.noteId)) { | ||||
|         throw new Error(`Creating child notes into '${parentNote.noteId}' is not allowed.`); | ||||
|     } | ||||
| 
 | ||||
|     if (['lb_availablelaunchers', 'lb_visiblelaunchers'].includes(parentNote.noteId) && params.type !== 'launcher') { | ||||
|     if (['lbAvailableLaunchers', 'lbVisibleLaunchers'].includes(parentNote.noteId) && params.type !== 'launcher') { | ||||
|         throw new Error(`Creating child notes into '${parentNote.noteId}' is only possible for type 'launcher'.`); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -4,6 +4,7 @@ const becca = require("../becca/becca"); | ||||
| const noteService = require("./notes"); | ||||
| const cls = require("./cls"); | ||||
| const dateUtils = require("./date_utils"); | ||||
| const log = require("./log.js"); | ||||
| 
 | ||||
| const LBTPL_ROOT = "lbtpl_root"; | ||||
| const LBTPL_BASE = "lbtpl_base"; | ||||
| @ -253,12 +254,12 @@ function getBulkActionNote() { | ||||
| } | ||||
| 
 | ||||
| function getLaunchBarRoot() { | ||||
|     let note = becca.getNote('lb_root'); | ||||
|     let note = becca.getNote('lbRoot'); | ||||
| 
 | ||||
|     if (!note) { | ||||
|         note = noteService.createNewNote({ | ||||
|             branchId: 'lb_root', | ||||
|             noteId: 'lb_root', | ||||
|             branchId: 'lbRoot', | ||||
|             noteId: 'lbRoot', | ||||
|             title: 'Launch bar', | ||||
|             type: 'doc', | ||||
|             content: '', | ||||
| @ -273,12 +274,12 @@ function getLaunchBarRoot() { | ||||
| } | ||||
| 
 | ||||
| function getLaunchBarAvailableLaunchersRoot() { | ||||
|     let note = becca.getNote('lb_availablelaunchers'); | ||||
|     let note = becca.getNote('lbAvailableLaunchers'); | ||||
| 
 | ||||
|     if (!note) { | ||||
|         note = noteService.createNewNote({ | ||||
|             branchId: 'lb_availablelaunchers', | ||||
|             noteId: 'lb_availablelaunchers', | ||||
|             branchId: 'lbAvailableLaunchers', | ||||
|             noteId: 'lbAvailableLaunchers', | ||||
|             title: 'Available launchers', | ||||
|             type: 'doc', | ||||
|             content: '', | ||||
| @ -290,7 +291,7 @@ function getLaunchBarAvailableLaunchersRoot() { | ||||
|         note.addLabel("docName", "launchbar_intro"); | ||||
|     } | ||||
| 
 | ||||
|     const branch = becca.getBranch('lb_availablelaunchers'); | ||||
|     const branch = becca.getBranch('lbAvailableLaunchers'); | ||||
|     if (!branch.isExpanded) { | ||||
|         branch.isExpanded = true; | ||||
|         branch.save(); | ||||
| @ -300,12 +301,12 @@ function getLaunchBarAvailableLaunchersRoot() { | ||||
| } | ||||
| 
 | ||||
| function getLaunchBarVisibleLaunchersRoot() { | ||||
|     let note = becca.getNote('lb_visiblelaunchers'); | ||||
|     let note = becca.getNote('lbVisibleLaunchers'); | ||||
| 
 | ||||
|     if (!note) { | ||||
|         note = noteService.createNewNote({ | ||||
|             branchId: 'lb_visiblelaunchers', | ||||
|             noteId: 'lb_visiblelaunchers', | ||||
|             branchId: 'lbVisibleLaunchers', | ||||
|             noteId: 'lbVisibleLaunchers', | ||||
|             title: 'Visible launchers', | ||||
|             type: 'doc', | ||||
|             content: '', | ||||
| @ -317,7 +318,7 @@ function getLaunchBarVisibleLaunchersRoot() { | ||||
|         note.addLabel("docName", "launchbar_intro"); | ||||
|     } | ||||
| 
 | ||||
|     const branch = becca.getBranch('lb_visiblelaunchers'); | ||||
|     const branch = becca.getBranch('lbVisibleLaunchers'); | ||||
|     if (!branch.isExpanded) { | ||||
|         branch.isExpanded = true; | ||||
|         branch.save(); | ||||
| @ -328,21 +329,21 @@ function getLaunchBarVisibleLaunchersRoot() { | ||||
| 
 | ||||
| const launchers = [ | ||||
|     // visible launchers:
 | ||||
|     { id: 'lb_newnote', command: 'createNoteIntoInbox', title: 'New note', icon: 'bx bx-file-blank', isVisible: true }, | ||||
|     { id: 'lb_search', command: 'searchNotes', title: 'Search notes', icon: 'bx bx-search', isVisible: true }, | ||||
|     { id: 'lb_jumpto', command: 'jumpToNote', title: 'Jump to note', icon: 'bx bx-send', isVisible: true }, | ||||
|     { id: 'lb_notemap', targetNoteId: 'globalNotemap', title: 'Note map', icon: 'bx bx-map-alt', isVisible: true }, | ||||
|     { id: 'lb_calendar', builtinWidget: 'calendar', title: 'Calendar', icon: 'bx bx-calendar', isVisible: true }, | ||||
|     { id: 'lb_spacer1', builtinWidget: 'spacer', title: 'Spacer', isVisible: true, baseSize: "50", growthFactor: "0" }, | ||||
|     { id: 'lb_bookmarks', builtinWidget: 'bookmarks', title: 'Bookmarks', icon: 'bx bx-bookmark', isVisible: true }, | ||||
|     { id: 'lb_spacer2', builtinWidget: 'spacer', title: 'Spacer', isVisible: true, baseSize: "0", growthFactor: "1" }, | ||||
|     { id: 'lb_protectedsession', builtinWidget: 'protectedSession', title: 'Protected session', icon: 'bx bx bx-shield-quarter', isVisible: true }, | ||||
|     { id: 'lb_syncstatus', builtinWidget: 'syncStatus', title: 'Sync status', icon: 'bx bx-wifi', isVisible: true }, | ||||
|     { id: 'lbNewNote', command: 'createNoteIntoInbox', title: 'New note', icon: 'bx bx-file-blank', isVisible: true }, | ||||
|     { id: 'lbSearch', command: 'searchNotes', title: 'Search notes', icon: 'bx bx-search', isVisible: true }, | ||||
|     { id: 'lbJumpTo', command: 'jumpToNote', title: 'Jump to note', icon: 'bx bx-send', isVisible: true }, | ||||
|     { id: 'lbNoteMap', targetNoteId: 'globalNotemap', title: 'Note map', icon: 'bx bx-map-alt', isVisible: true }, | ||||
|     { id: 'lbCalendar', builtinWidget: 'calendar', title: 'Calendar', icon: 'bx bx-calendar', isVisible: true }, | ||||
|     { id: 'lbSpacer1', builtinWidget: 'spacer', title: 'Spacer', isVisible: true, baseSize: "50", growthFactor: "0" }, | ||||
|     { id: 'lbBookmarks', builtinWidget: 'bookmarks', title: 'Bookmarks', icon: 'bx bx-bookmark', isVisible: true }, | ||||
|     { id: 'lbSpacer2', builtinWidget: 'spacer', title: 'Spacer', isVisible: true, baseSize: "0", growthFactor: "1" }, | ||||
|     { id: 'lbProtectedSession', builtinWidget: 'protectedSession', title: 'Protected session', icon: 'bx bx bx-shield-quarter', isVisible: true }, | ||||
|     { id: 'lbSyncStatus', builtinWidget: 'syncStatus', title: 'Sync status', icon: 'bx bx-wifi', isVisible: true }, | ||||
| 
 | ||||
|     // available launchers:
 | ||||
|     { id: 'lb_recentchanges', command: 'showRecentChanges', title: 'Recent changes', icon: 'bx bx-history', isVisible: false }, | ||||
|     { id: 'lb_backinhistory', builtinWidget: 'backInHistoryButton', title: 'Back in history', icon: 'bx bxs-left-arrow-square', isVisible: false }, | ||||
|     { id: 'lb_forwardinhistory', builtinWidget: 'forwardInHistoryButton', title: 'Forward in history', icon: 'bx bxs-right-arrow-square', isVisible: false }, | ||||
|     { id: 'lbRecentChanges', command: 'showRecentChanges', title: 'Recent changes', icon: 'bx bx-history', isVisible: false }, | ||||
|     { id: 'lbBackInHistory', builtinWidget: 'backInHistoryButton', title: 'Back in history', icon: 'bx bxs-left-arrow-square', isVisible: false }, | ||||
|     { id: 'lbForwardInHistory', builtinWidget: 'forwardInHistoryButton', title: 'Forward in history', icon: 'bx bxs-right-arrow-square', isVisible: false }, | ||||
| ]; | ||||
| 
 | ||||
| function createLaunchers() { | ||||
| @ -628,11 +629,11 @@ function createMissingSpecialNotes() { | ||||
| } | ||||
| 
 | ||||
| function resetLauncher(noteId) { | ||||
|     if (noteId.startsWith('lb_')) { | ||||
|     const note = becca.getNote(noteId); | ||||
| 
 | ||||
|     if (note.isLauncherConfig()) { | ||||
|         if (note) { | ||||
|             if (noteId === 'lb_root') { | ||||
|             if (noteId === 'lbRoot') { | ||||
|                 // deleting hoisted notes are not allowed, so we just reset the children
 | ||||
|                 for (const childNote of note.getChildNotes()) { | ||||
|                     childNote.deleteNote(); | ||||
|  | ||||
| @ -30,7 +30,7 @@ function getNotes(noteIds) { | ||||
| } | ||||
| 
 | ||||
| function validateParentChild(parentNoteId, childNoteId, branchId = null) { | ||||
|     if (['root', 'hidden', 'share', 'lb_root', 'lb_availablelaunchers', 'lb_visiblelaunchers'].includes(childNoteId)) { | ||||
|     if (['root', 'hidden', 'share', 'lbRoot', 'lbAvailableLaunchers', 'lbVisibleLaunchers'].includes(childNoteId)) { | ||||
|         return { success: false, message: `Cannot change this note's location.`}; | ||||
|     } | ||||
| 
 | ||||
| @ -58,7 +58,7 @@ function validateParentChild(parentNoteId, childNoteId, branchId = null) { | ||||
|         }; | ||||
|     } | ||||
| 
 | ||||
|     if (parentNoteId !== 'lb_bookmarks' && becca.getNote(parentNoteId).type === 'launcher') { | ||||
|     if (parentNoteId !== 'lbBookmarks' && becca.getNote(parentNoteId).type === 'launcher') { | ||||
|         return { | ||||
|             success: false, | ||||
|             message: 'Launcher note cannot have any children.' | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam