@ -2,18 +2,18 @@ const becca = require("../becca/becca");
const noteService = require ( "./notes" ) ;
const noteService = require ( "./notes" ) ;
const log = require ( "./log" ) ;
const log = require ( "./log" ) ;
const LBTPL _ROOT = " lbTplRoot";
const LBTPL _ROOT = " _ lbTplRoot";
const LBTPL _BASE = " lbTplBase";
const LBTPL _BASE = " _ lbTplBase";
const LBTPL _COMMAND = " lbTplCommandLauncher";
const LBTPL _COMMAND = " _ lbTplCommandLauncher";
const LBTPL _NOTE _LAUNCHER = " lbTplNoteLauncher";
const LBTPL _NOTE _LAUNCHER = " _ lbTplNoteLauncher";
const LBTPL _SCRIPT = " lbTplScriptLauncher";
const LBTPL _SCRIPT = " _ lbTplScriptLauncher";
const LBTPL _BUILTIN _WIDGET = " lbTplBuiltinWidget";
const LBTPL _BUILTIN _WIDGET = " _ lbTplBuiltinWidget";
const LBTPL _SPACER = " lbTplSpacer";
const LBTPL _SPACER = " _ lbTplSpacer";
const LBTPL _CUSTOM _WIDGET = " lbTplCustomWidget";
const LBTPL _CUSTOM _WIDGET = " _ lbTplCustomWidget";
const HIDDEN _SUBTREE _DEFINITION = {
const HIDDEN _SUBTREE _DEFINITION = {
id : ' hidden',
id : ' _ hidden',
title : ' hidden',
title : ' _ hidden',
type : 'doc' ,
type : 'doc' ,
icon : 'bx bx-chip' ,
icon : 'bx bx-chip' ,
// we want to keep the hidden subtree always last, otherwise there will be problems with e.g. keyboard navigation
// we want to keep the hidden subtree always last, otherwise there will be problems with e.g. keyboard navigation
@ -24,12 +24,12 @@ const HIDDEN_SUBTREE_DEFINITION = {
] ,
] ,
children : [
children : [
{
{
id : ' search',
id : ' _ search',
title : 'Search History' ,
title : 'Search History' ,
type : 'doc'
type : 'doc'
} ,
} ,
{
{
id : ' globalNoteMap',
id : ' _ globalNoteMap',
title : 'Note Map' ,
title : 'Note Map' ,
type : 'noteMap' ,
type : 'noteMap' ,
attributes : [
attributes : [
@ -38,24 +38,24 @@ const HIDDEN_SUBTREE_DEFINITION = {
]
]
} ,
} ,
{
{
id : ' sqlConsole',
id : ' _ sqlConsole',
title : 'SQL Console History' ,
title : 'SQL Console History' ,
type : 'doc' ,
type : 'doc' ,
icon : 'bx-data'
icon : 'bx-data'
} ,
} ,
{
{
id : ' share',
id : ' _ share',
title : 'Shared Notes' ,
title : 'Shared Notes' ,
type : 'doc' ,
type : 'doc' ,
attributes : [ { type : 'label' , name : 'docName' , value : ' share' } ]
attributes : [ { type : 'label' , name : 'docName' , value : ' _ share' } ]
} ,
} ,
{
{
id : ' bulkAction',
id : ' _ bulkAction',
title : 'Bulk action' ,
title : 'Bulk action' ,
type : 'doc' ,
type : 'doc' ,
} ,
} ,
{
{
id : ' backendLog',
id : ' _ backendLog',
title : 'Backend Log' ,
title : 'Backend Log' ,
type : 'contentWidget' ,
type : 'contentWidget' ,
icon : 'bx-terminal' ,
icon : 'bx-terminal' ,
@ -65,7 +65,7 @@ const HIDDEN_SUBTREE_DEFINITION = {
} ,
} ,
{
{
// place for user scripts hidden stuff (scripts should not create notes directly under hidden root)
// place for user scripts hidden stuff (scripts should not create notes directly under hidden root)
id : ' userHidden',
id : ' _ userHidden',
title : 'User Hidden' ,
title : 'User Hidden' ,
type : 'text' ,
type : 'text' ,
} ,
} ,
@ -150,7 +150,7 @@ const HIDDEN_SUBTREE_DEFINITION = {
]
]
} ,
} ,
{
{
id : ' lbRoot',
id : ' _ lbRoot',
title : 'Launch bar' ,
title : 'Launch bar' ,
type : 'doc' ,
type : 'doc' ,
icon : 'bx-sidebar' ,
icon : 'bx-sidebar' ,
@ -158,65 +158,65 @@ const HIDDEN_SUBTREE_DEFINITION = {
attributes : [ { type : 'label' , name : 'docName' , value : 'launchbar_intro' } ] ,
attributes : [ { type : 'label' , name : 'docName' , value : 'launchbar_intro' } ] ,
children : [
children : [
{
{
id : ' lbAvailableLaunchers',
id : ' _ lbAvailableLaunchers',
title : 'Available Launchers' ,
title : 'Available Launchers' ,
type : 'doc' ,
type : 'doc' ,
icon : 'bx-hide' ,
icon : 'bx-hide' ,
isExpanded : true ,
isExpanded : true ,
attributes : [ { type : 'label' , name : 'docName' , value : 'launchbar_intro' } ] ,
attributes : [ { type : 'label' , name : 'docName' , value : 'launchbar_intro' } ] ,
children : [
children : [
{ id : ' lbBackInHistory', title : 'Back in History' , type : 'launcher' , builtinWidget : 'backInHistoryButton' , icon : 'bx bxs-left-arrow-square' } ,
{ id : ' _ lbBackInHistory', title : 'Back in History' , type : 'launcher' , builtinWidget : 'backInHistoryButton' , icon : 'bx bxs-left-arrow-square' } ,
{ id : ' lbForwardInHistory', title : 'Forward in History' , type : 'launcher' , builtinWidget : 'forwardInHistoryButton' , icon : 'bx bxs-right-arrow-square' } ,
{ id : ' _ lbForwardInHistory', title : 'Forward in History' , type : 'launcher' , builtinWidget : 'forwardInHistoryButton' , icon : 'bx bxs-right-arrow-square' } ,
{ id : ' lbBackendLog', title : 'Backend Log' , type : 'launcher' , targetNoteId : ' backendLog', icon : 'bx bx-terminal' } ,
{ id : ' _ lbBackendLog', title : 'Backend Log' , type : 'launcher' , targetNoteId : ' _ backendLog', icon : 'bx bx-terminal' } ,
]
]
} ,
} ,
{
{
id : ' lbVisibleLaunchers',
id : ' _ lbVisibleLaunchers',
title : 'Visible Launchers' ,
title : 'Visible Launchers' ,
type : 'doc' ,
type : 'doc' ,
icon : 'bx-show' ,
icon : 'bx-show' ,
isExpanded : true ,
isExpanded : true ,
attributes : [ { type : 'label' , name : 'docName' , value : 'launchbar_intro' } ] ,
attributes : [ { type : 'label' , name : 'docName' , value : 'launchbar_intro' } ] ,
children : [
children : [
{ id : ' lbNewNote', title : 'New Note' , type : 'launcher' , command : 'createNoteIntoInbox' , icon : 'bx bx-file-blank' } ,
{ id : ' _ lbNewNote', title : 'New Note' , type : 'launcher' , command : 'createNoteIntoInbox' , icon : 'bx bx-file-blank' } ,
{ id : ' lbSearch', title : 'Search Notes' , type : 'launcher' , command : 'searchNotes' , icon : 'bx bx-search' , attributes : [
{ id : ' _ lbSearch', title : 'Search Notes' , type : 'launcher' , command : 'searchNotes' , icon : 'bx bx-search' , attributes : [
{ type : 'label' , name : 'desktopOnly' }
{ type : 'label' , name : 'desktopOnly' }
] } ,
] } ,
{ id : ' lbJumpTo', title : 'Jump to Note' , type : 'launcher' , command : 'jumpToNote' , icon : 'bx bx-send' , attributes : [
{ id : ' _ lbJumpTo', title : 'Jump to Note' , type : 'launcher' , command : 'jumpToNote' , icon : 'bx bx-send' , attributes : [
{ type : 'label' , name : 'desktopOnly' }
{ type : 'label' , name : 'desktopOnly' }
] } ,
] } ,
{ id : ' lbNoteMap', title : 'Note Map' , type : 'launcher' , targetNoteId : ' globalNoteMap', icon : 'bx bx-map-alt' } ,
{ id : ' _ lbNoteMap', title : 'Note Map' , type : 'launcher' , targetNoteId : ' _ globalNoteMap', icon : 'bx bx-map-alt' } ,
{ id : ' lbCalendar', title : 'Calendar' , type : 'launcher' , builtinWidget : 'calendar' , icon : 'bx bx-calendar' } ,
{ id : ' _ lbCalendar', title : 'Calendar' , type : 'launcher' , builtinWidget : 'calendar' , icon : 'bx bx-calendar' } ,
{ id : ' lbRecentChanges', title : 'Recent Changes' , type : 'launcher' , command : 'showRecentChanges' , icon : 'bx bx-history' , attributes : [
{ id : ' _ lbRecentChanges', title : 'Recent Changes' , type : 'launcher' , command : 'showRecentChanges' , icon : 'bx bx-history' , attributes : [
{ type : 'label' , name : 'desktopOnly' }
{ type : 'label' , name : 'desktopOnly' }
] } ,
] } ,
{ id : ' lbSpacer1', title : 'Spacer' , type : 'launcher' , builtinWidget : 'spacer' , baseSize : "50" , growthFactor : "0" } ,
{ id : ' _ lbSpacer1', title : 'Spacer' , type : 'launcher' , builtinWidget : 'spacer' , baseSize : "50" , growthFactor : "0" } ,
{ id : ' lbBookmarks', title : 'Bookmarks' , type : 'launcher' , builtinWidget : 'bookmarks' , icon : 'bx bx-bookmark' } ,
{ id : ' _ lbBookmarks', title : 'Bookmarks' , type : 'launcher' , builtinWidget : 'bookmarks' , icon : 'bx bx-bookmark' } ,
{ id : ' lbToday', title : "Open Today's Journal Note" , type : 'launcher' , builtinWidget : 'todayInJournal' , icon : 'bx bx-calendar-star' } ,
{ id : ' _ lbToday', title : "Open Today's Journal Note" , type : 'launcher' , builtinWidget : 'todayInJournal' , icon : 'bx bx-calendar-star' } ,
{ id : ' lbSpacer2', title : 'Spacer' , type : 'launcher' , builtinWidget : 'spacer' , baseSize : "0" , growthFactor : "1" } ,
{ id : ' _ lbSpacer2', title : 'Spacer' , type : 'launcher' , builtinWidget : 'spacer' , baseSize : "0" , growthFactor : "1" } ,
{ id : ' lbProtectedSession', title : 'Protected Session' , type : 'launcher' , builtinWidget : 'protectedSession' , icon : 'bx bx bx-shield-quarter' } ,
{ id : ' _ lbProtectedSession', title : 'Protected Session' , type : 'launcher' , builtinWidget : 'protectedSession' , icon : 'bx bx bx-shield-quarter' } ,
{ id : ' lbSyncStatus', title : 'Sync Status' , type : 'launcher' , builtinWidget : 'syncStatus' , icon : 'bx bx-wifi' }
{ id : ' _ lbSyncStatus', title : 'Sync Status' , type : 'launcher' , builtinWidget : 'syncStatus' , icon : 'bx bx-wifi' }
]
]
}
}
]
]
} ,
} ,
{
{
id : ' options',
id : ' _ options',
title : 'Options' ,
title : 'Options' ,
type : 'book' ,
type : 'book' ,
children : [
children : [
{ id : ' optionsAppearance', title : 'Appearance' , type : 'contentWidget' , icon : 'bx-layout' } ,
{ id : ' _ optionsAppearance', title : 'Appearance' , type : 'contentWidget' , icon : 'bx-layout' } ,
{ id : ' optionsShortcuts', title : 'Shortcuts' , type : 'contentWidget' , icon : 'bxs-keyboard' } ,
{ id : ' _ optionsShortcuts', title : 'Shortcuts' , type : 'contentWidget' , icon : 'bxs-keyboard' } ,
{ id : ' optionsTextNotes', title : 'Text Notes' , type : 'contentWidget' , icon : 'bx-text' } ,
{ id : ' _ optionsTextNotes', title : 'Text Notes' , type : 'contentWidget' , icon : 'bx-text' } ,
{ id : ' optionsCodeNotes', title : 'Code Notes' , type : 'contentWidget' , icon : 'bx-code' } ,
{ id : ' _ optionsCodeNotes', title : 'Code Notes' , type : 'contentWidget' , icon : 'bx-code' } ,
{ id : ' optionsImages', title : 'Images' , type : 'contentWidget' , icon : 'bx-image' } ,
{ id : ' _ optionsImages', title : 'Images' , type : 'contentWidget' , icon : 'bx-image' } ,
{ id : ' optionsSpellcheck', title : 'Spellcheck' , type : 'contentWidget' , icon : 'bx-check-double' } ,
{ id : ' _ optionsSpellcheck', title : 'Spellcheck' , type : 'contentWidget' , icon : 'bx-check-double' } ,
{ id : ' optionsPassword', title : 'Password' , type : 'contentWidget' , icon : 'bx-lock' } ,
{ id : ' _ optionsPassword', title : 'Password' , type : 'contentWidget' , icon : 'bx-lock' } ,
{ id : ' optionsEtapi', title : 'ETAPI' , type : 'contentWidget' , icon : 'bx-extension' } ,
{ id : ' _ optionsEtapi', title : 'ETAPI' , type : 'contentWidget' , icon : 'bx-extension' } ,
{ id : ' optionsBackup', title : 'Backup' , type : 'contentWidget' , icon : 'bx-data' } ,
{ id : ' _ optionsBackup', title : 'Backup' , type : 'contentWidget' , icon : 'bx-data' } ,
{ id : ' optionsSync', title : 'Sync' , type : 'contentWidget' , icon : 'bx-wifi' } ,
{ id : ' _ optionsSync', title : 'Sync' , type : 'contentWidget' , icon : 'bx-wifi' } ,
{ id : ' optionsOther', title : 'Other' , type : 'contentWidget' , icon : 'bx-dots-horizontal' } ,
{ id : ' _ optionsOther', title : 'Other' , type : 'contentWidget' , icon : 'bx-dots-horizontal' } ,
{ id : ' optionsAdvanced', title : 'Advanced' , type : 'contentWidget' }
{ id : ' _ optionsAdvanced', title : 'Advanced' , type : 'contentWidget' }
]
]
}
}
]
]
@ -231,9 +231,9 @@ function checkHiddenSubtreeRecursively(parentNoteId, item) {
throw new Error ( ` Item does not contain mandatory properties: ${ JSON . stringify ( item ) } ` ) ;
throw new Error ( ` Item does not contain mandatory properties: ${ JSON . stringify ( item ) } ` ) ;
}
}
// if (item.id.charAt(0) !== '_') {
if ( item . id . charAt ( 0 ) !== '_' ) {
// throw new Error("ID has to start with underscore");
throw new Error ( ` ID has to start with underscore, given ' ${ item . id } ' ` ) ;
// }
}
let note = becca . notes [ item . id ] ;
let note = becca . notes [ item . id ] ;
let branch = becca . branches [ item . id ] ;
let branch = becca . branches [ item . id ] ;
@ -311,5 +311,13 @@ function checkHiddenSubtreeRecursively(parentNoteId, item) {
}
}
module . exports = {
module . exports = {
checkHiddenSubtree
checkHiddenSubtree ,
LBTPL _ROOT ,
LBTPL _BASE ,
LBTPL _COMMAND ,
LBTPL _NOTE _LAUNCHER ,
LBTPL _SCRIPT ,
LBTPL _BUILTIN _WIDGET ,
LBTPL _SPACER ,
LBTPL _CUSTOM _WIDGET
} ;
} ;