Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(mobile/nav): functional +/[...] buttons for header
Elian Doran8d009756ed11
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 6908ec811f..5d179cfec9 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1866,7 +1866,9 @@"loading": "Loading...","empty": "This note has no children.","children_count_one": "{{count}} note",- "children_count_other": "{{count}} notes"+ "children_count_other": "{{count}} notes",+ "add_child": "Add child note",+ "more_actions": "More actions"},"title_bar_buttons": {"window-on-top": "Keep Window on Top"diff --git a/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.css b/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.cssindex 3f13b79412..8985c2b8f2 100644--- a/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.css+++ b/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.css@@ -160,10 +160,25 @@font-weight: 600;}-.mobile-navigator-current-open {+.mobile-navigator-current-action {flex: 0 0 auto;- font-size: 1.1em;- opacity: 0.6;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 36px;+ height: 36px;+ padding: 0;+ border: none;+ border-radius: 50%;+ background: transparent;+ color: inherit;+ font-size: 1.2em;+ cursor: pointer;+ -webkit-tap-highlight-color: transparent;+}++.mobile-navigator-current-action:active {+ background: var(--hover-item-background-color);}.mobile-navigator-current-preview {diff --git a/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.tsx b/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.tsxindex cdcc5b5f28..b94aa441c4 100644--- a/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.tsx+++ b/apps/client/src/widgets/mobile_widgets/MobileNoteNavigator.tsx@@ -11,6 +11,7 @@ import { getReadableTextColor } from "../../services/css_class_manager";import froca from "../../services/froca";import hoisted_note from "../../services/hoisted_note";import { t } from "../../services/i18n";+import note_create from "../../services/note_create";import utils from "../../services/utils";import { NoteContent } from "../collections/legacy/ListOrGridView";import { Badge } from "../react/Badge";@@ -255,7 +256,30 @@ export default function MobileNoteNavigator() {<div className="mobile-navigator-current-header"><Icon icon={parentIcon ?? "bx bx-folder"} className="mobile-navigator-current-icon" /><span className="mobile-navigator-current-title">{parentTitle ?? parentNote.title}</span>- <Icon icon="bx bx-link-external" className="mobile-navigator-current-open" />+ <button+ type="button"+ className="mobile-navigator-current-action"+ aria-label={t("mobile_note_navigator.add_child")}+ title={t("mobile_note_navigator.add_child")}+ onClick={(e) => {+ e.stopPropagation();+ if (currentParentPath) note_create.createNote(currentParentPath);+ }}+ >+ <Icon icon="bx bx-plus" />+ </button>+ <button+ type="button"+ className="mobile-navigator-current-action"+ aria-label={t("mobile_note_navigator.more_actions")}+ title={t("mobile_note_navigator.more_actions")}+ onClick={(e) => {+ e.stopPropagation();+ currentContextHandler(e as unknown as MouseEvent);+ }}+ >+ <Icon icon="bx bx-dots-horizontal-rounded" />+ </button></div><div className="mobile-navigator-current-preview"><NoteContent@@ -491,10 +515,16 @@ function buildNoteContextMenu(notePath: string, parentComponent: Component | nulconst segments = notePath.split("/");const noteId = segments[segments.length - 1];- const parentNoteId = segments.length >= 2 ? segments[segments.length - 2] : undefined;- if (!noteId || !parentNoteId) return;-- const branchId = await froca.getBranchId(parentNoteId, noteId);+ if (!noteId) return;+ // If the path has no parent segment (top of a hoisted column), fall back to one of+ // the note's actual parents so the menu still works for hoisted roots. Root itself+ // resolves through the special "none_root" branch and needs no parent.+ const parentNoteId = segments.length >= 2+ ? segments[segments.length - 2]+ : froca.getNoteFromCache(noteId)?.getParentNoteIds()[0];+ if (noteId !== "root" && !parentNoteId) return;++ const branchId = await froca.getBranchId(parentNoteId ?? "", noteId);if (!branchId) return;const branch = froca.getBranch(branchId);if (!branch) return;