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/split): hide split button if split is already open
Elian Doranf5940cbf70c3
diff --git a/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx b/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsxindex e1fa23cc10..0c6c3dfff3 100644--- a/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx+++ b/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx@@ -21,22 +21,29 @@ export default function MobileDetailMenu() {if (!ntxId) return;const noteContext = appContext.tabManager.getNoteContextById(ntxId);+ const subContexts = noteContext.getMainContext().getSubContexts();+ const isMainContext = noteContext?.isMainContext();const note = noteContext.note;- const items: (MenuItem<keyof CommandMappings> | false)[] = [+ const items: (MenuItem<keyof CommandMappings>)[] = [{ title: t("mobile_detail_menu.insert_child_note"), command: "insertChildNote", uiIcon: "bx bx-plus", enabled: note?.type !== "search" },{ title: t("mobile_detail_menu.delete_this_note"), command: "delete", uiIcon: "bx bx-trash", enabled: note?.noteId !== "root" },{ kind: "separator" },{ title: t("mobile_detail_menu.note_revisions"), command: "showRevisions", uiIcon: "bx bx-history" },{ kind: "separator" },- { title: t("create_pane_button.create_new_split"), command: "openNewNoteSplit", uiIcon: "bx bx-dock-right" },- !noteContext?.isMainContext() && { title: t("close_pane_button.close_this_pane"), command: "closeThisNoteSplit", uiIcon: "bx bx-x" }- ];+ subContexts.length < 2 && { title: t("create_pane_button.create_new_split"), command: "openNewNoteSplit", uiIcon: "bx bx-dock-right" },+ !isMainContext && { title: t("close_pane_button.close_this_pane"), command: "closeThisNoteSplit", uiIcon: "bx bx-x" }+ ].filter(i => !!i) as MenuItem<keyof CommandMappings>[];++ const lastItem = items.at(-1);+ if (lastItem && "kind" in lastItem && lastItem.kind === "separator") {+ items.pop();+ }contextMenu.show<keyof CommandMappings>({x: e.pageX,y: e.pageY,- items: items.filter(i => !!i),+ items,selectMenuItemHandler: async ({ command }) => {if (command === "insertChildNote") {note_create.createNote(appContext.tabManager.getActiveContextNotePath() ?? undefined);