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
chore(mobile/split): improve obtaining of the note context
Elian Doran6ab05fdb7618
diff --git a/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx b/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsxindex 8859f7b3d1..e1fa23cc10 100644--- a/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx+++ b/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx@@ -17,8 +17,11 @@ export default function MobileDetailMenu() {icon="bx bx-dots-vertical-rounded"text=""onClick={(e) => {- const note = appContext.tabManager.getActiveContextNote();- const noteContext = appContext.tabManager.getActiveContext();+ const ntxId = (parentComponent as BasicWidget).getClosestNtxId();+ if (!ntxId) return;++ const noteContext = appContext.tabManager.getNoteContextById(ntxId);+ const note = noteContext.note;const items: (MenuItem<keyof CommandMappings> | false)[] = [{ title: t("mobile_detail_menu.insert_child_note"), command: "insertChildNote", uiIcon: "bx bx-plus", enabled: note?.type !== "search" },@@ -53,7 +56,6 @@ export default function MobileDetailMenu() {parentComponent.triggerCommand("setActiveScreen", { screen: "tree" });}} else if (command && parentComponent) {- const ntxId = (parentComponent as BasicWidget).getClosestNtxId();parentComponent.triggerCommand(command, { ntxId });}},