diff --git a/src/public/app/widgets/history_navigation.js b/src/public/app/widgets/history_navigation.js
index 4d18926df..182cad0c1 100644
--- a/src/public/app/widgets/history_navigation.js
+++ b/src/public/app/widgets/history_navigation.js
@@ -1,6 +1,6 @@
import BasicWidget from "./basic_widget.js";
import utils from "../services/utils.js";
-import contextMenu from "../services/context_menu.js";
+import contextMenu from "../menus/context_menu.js";
import treeService from "../services/tree.js";
const TPL = `
diff --git a/src/public/app/widgets/mobile_widgets/mobile_detail_menu.js b/src/public/app/widgets/mobile_widgets/mobile_detail_menu.js
index 8305a5bde..c4518a856 100644
--- a/src/public/app/widgets/mobile_widgets/mobile_detail_menu.js
+++ b/src/public/app/widgets/mobile_widgets/mobile_detail_menu.js
@@ -1,6 +1,6 @@
import BasicWidget from "../basic_widget.js";
import appContext from "../../services/app_context.js";
-import contextMenu from "../../services/context_menu.js";
+import contextMenu from "../../menus/context_menu.js";
import noteCreateService from "../../services/note_create.js";
import branchService from "../../services/branches.js";
import treeService from "../../services/tree.js";
diff --git a/src/public/app/widgets/note_map.js b/src/public/app/widgets/note_map.js
index 60bd74eeb..7d1d3e131 100644
--- a/src/public/app/widgets/note_map.js
+++ b/src/public/app/widgets/note_map.js
@@ -4,7 +4,7 @@ import attributeService from "../services/attributes.js";
import hoistedNoteService from "../services/hoisted_note.js";
import appContext from "../services/app_context.js";
import NoteContextAwareWidget from "./note_context_aware_widget.js";
-import linkContextMenuService from "../services/link_context_menu.js";
+import linkContextMenuService from "../menus/link_context_menu.js";
const TPL = `
diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js
index 137e6a8f7..7e7d0e6f7 100644
--- a/src/public/app/widgets/note_tree.js
+++ b/src/public/app/widgets/note_tree.js
@@ -1,7 +1,7 @@
import hoistedNoteService from "../services/hoisted_note.js";
import treeService from "../services/tree.js";
import utils from "../services/utils.js";
-import contextMenu from "../services/context_menu.js";
+import contextMenu from "../menus/context_menu.js";
import froca from "../services/froca.js";
import branchService from "../services/branches.js";
import ws from "../services/ws.js";
@@ -87,6 +87,10 @@ const TPL = `
width: 340px;
border-radius: 10px;
}
+
+ .tree .hidden-node-is-hidden {
+ display: none;
+ }
@@ -361,6 +365,10 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
return false;
}
},
+ beforeActivate: (event, data) => {
+ // hidden subtree is hidden hackily, prevent activating it e.g. by keyboard
+ return data.node.data.noteId !== 'hidden';
+ },
activate: async (event, data) => {
// click event won't propagate so let's close context menu manually
contextMenu.hide();
@@ -569,10 +577,17 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
this.$tree.on('contextmenu', '.fancytree-node', e => {
const node = $.ui.fancytree.getNode(e);
- import("../services/tree_context_menu.js").then(({default: TreeContextMenu}) => {
- const treeContextMenu = new TreeContextMenu(this, node);
- treeContextMenu.show(e);
- });
+ if (hoistedNoteService.getHoistedNoteId() === 'lb_root') {
+ import("../menus/shortcut_context_menu.js").then(({default: ShortcutContextMenu}) => {
+ const shortcutContextMenu = new ShortcutContextMenu(this, node);
+ shortcutContextMenu.show(e);
+ });
+ } else {
+ import("../menus/tree_context_menu.js").then(({default: TreeContextMenu}) => {
+ const treeContextMenu = new TreeContextMenu(this, node);
+ treeContextMenu.show(e);
+ });
+ }
return false; // blocks default browser right click menu
});
@@ -1250,14 +1265,22 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
if (this.noteContext.hoistedNoteId === 'root') {
this.tree.clearFilter();
+ this.toggleHiddenNode(false); // show everything but the hidden subtree
} else {
// hack when hoisted note is cloned then it could be filtered multiple times while we want only 1
this.tree.filterBranches(node =>
node.data.noteId === this.noteContext.hoistedNoteId // optimization to not having always resolve the node path
&& treeService.getNotePath(node) === hoistedNotePath);
+
+ this.toggleHiddenNode(true); // hoisting will handle hidden note visibility
}
}
+ toggleHiddenNode(show) {
+ const hiddenNode = this.getNodesByNoteId('hidden')[0];
+ $(hiddenNode.li).toggleClass("hidden-node-is-hidden", !show);
+ }
+
frocaReloadedEvent() {
this.reloadTreeFromCache();
}
diff --git a/src/public/app/widgets/tab_row.js b/src/public/app/widgets/tab_row.js
index 38921da5a..68751a0f4 100644
--- a/src/public/app/widgets/tab_row.js
+++ b/src/public/app/widgets/tab_row.js
@@ -1,5 +1,5 @@
import BasicWidget from "./basic_widget.js";
-import contextMenu from "../services/context_menu.js";
+import contextMenu from "../menus/context_menu.js";
import utils from "../services/utils.js";
import keyboardActionService from "../services/keyboard_actions.js";
import appContext from "../services/app_context.js";
diff --git a/src/public/app/widgets/type_widgets/relation_map.js b/src/public/app/widgets/type_widgets/relation_map.js
index 615b9d069..3064ab2e0 100644
--- a/src/public/app/widgets/type_widgets/relation_map.js
+++ b/src/public/app/widgets/type_widgets/relation_map.js
@@ -1,7 +1,7 @@
import server from "../../services/server.js";
import linkService from "../../services/link.js";
import libraryLoader from "../../services/library_loader.js";
-import contextMenu from "../../services/context_menu.js";
+import contextMenu from "../../menus/context_menu.js";
import toastService from "../../services/toast.js";
import attributeAutocompleteService from "../../services/attribute_autocomplete.js";
import TypeWidget from "./type_widget.js";
diff --git a/src/public/stylesheets/tree.css b/src/public/stylesheets/tree.css
index c0cfa08dd..ddf9fc81b 100644
--- a/src/public/stylesheets/tree.css
+++ b/src/public/stylesheets/tree.css
@@ -72,11 +72,11 @@ span.fancytree-node.fancytree-hide {
color: inherit !important;
display: block;
border-radius: 50%;
- border-color: #000 transparent #000 transparent;
+ border-color: var(--main-text-color) transparent var(--main-text-color) transparent;
animation: lds-dual-ring 1.2s linear infinite;
width: 12px;
height: 12px;
- margin-top: 4px;
+ margin-top: 2px;
margin-left: 1px;
border-width: 1px;
border-style: solid;
diff --git a/src/routes/setup.js b/src/routes/setup.js
index 13718dedd..05d487efb 100644
--- a/src/routes/setup.js
+++ b/src/routes/setup.js
@@ -8,7 +8,8 @@ function setupPage(req, res) {
if (sqlInit.isDbInitialized()) {
if (utils.isElectron()) {
const windowService = require('../services/window');
- windowService.createMainWindow();
+ const {app} = require('electron');
+ windowService.createMainWindow(app);
windowService.closeSetupWindow();
}
else {
diff --git a/src/services/scheduler.js b/src/services/scheduler.js
index 3f253ba9b..20b964802 100644
--- a/src/services/scheduler.js
+++ b/src/services/scheduler.js
@@ -52,13 +52,13 @@ function runNotesWithLabel(runAttrValue) {
sqlInit.dbReady.then(() => {
if (!process.env.TRILIUM_SAFE_MODE) {
+ cls.init(() => specialNotesService.createMissingSpecialNotes());
+
setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000);
setInterval(cls.wrap(() => runNotesWithLabel('hourly')), 3600 * 1000);
setInterval(cls.wrap(() => runNotesWithLabel('daily')), 24 * 3600 * 1000);
-
- setTimeout(cls.wrap(() => specialNotesService.createMissingSpecialNotes()), 10 * 1000);
}
setInterval(() => protectedSessionService.checkProtectedSessionExpiration(), 30000);
diff --git a/src/services/special_notes.js b/src/services/special_notes.js
index 7321c25fd..490a2552f 100644
--- a/src/services/special_notes.js
+++ b/src/services/special_notes.js
@@ -267,6 +267,12 @@ function getLaunchBarAvailableShortcutsRoot() {
}).note;
}
+ const branch = becca.getBranch('lb_availableshortcuts');
+ if (!branch.isExpanded) {
+ branch.isExpanded = true;
+ branch.save();
+ }
+
return note;
}
@@ -284,6 +290,12 @@ function getLaunchBarVisibleShortcutsRoot() {
}).note;
}
+ const branch = becca.getBranch('lb_visibleshortcuts');
+ if (!branch.isExpanded) {
+ branch.isExpanded = true;
+ branch.save();
+ }
+
return note;
}
@@ -291,8 +303,9 @@ const shortcuts = [
{ 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', targetNote: 'globalnotemap', title: 'Note map', icon: 'bx bx-map-alt', isVisible: true },
- { id: 'lb_recentchanges', command: 'showRecentChanges', title: 'Show recent changes', icon: 'bx bx-history', isVisible: false }
+ { id: 'lb_notemap', targetNoteId: 'globalnotemap', title: 'Note map', icon: 'bx bx-map-alt', isVisible: true },
+ { id: 'lb_recentchanges', command: 'showRecentChanges', title: 'Recent changes', icon: 'bx bx-history', isVisible: false },
+ { id: 'lb_calendar', builtinWidget: 'calendar', title: 'Calendar', icon: 'bx bx-calendar', isVisible: true },
];
function createMissingSpecialNotes() {
@@ -320,7 +333,16 @@ function createMissingSpecialNotes() {
note.addLabel('builtinShortcut');
note.addLabel('iconClass', shortcut.icon);
- note.addLabel('command', shortcut.command);
+
+ if (shortcut.command) {
+ note.addLabel('command', shortcut.command);
+ } else if (shortcut.builtinWidget) {
+ note.addLabel('builtinWidget', shortcut.builtinWidget);
+ } else if (shortcut.targetNoteId) {
+ note.addRelation('targetNote', shortcut.targetNoteId);
+ } else {
+ throw new Error(`No action defined for shortcut ${JSON.stringify(shortcut)}`);
+ }
}
}