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): rephase open in note split if a split is already open
Elian Dorane0e9310907e0
diff --git a/apps/client/src/menus/link_context_menu.ts b/apps/client/src/menus/link_context_menu.tsindex 561a44efac..a8de838837 100644--- a/apps/client/src/menus/link_context_menu.ts+++ b/apps/client/src/menus/link_context_menu.ts@@ -2,22 +2,25 @@ import { t } from "../services/i18n.js";import contextMenu, { type ContextMenuEvent, type MenuItem } from "./context_menu.js";import appContext, { type CommandNames } from "../components/app_context.js";import type { ViewScope } from "../services/link.js";-import utils from "../services/utils.js";+import utils, { isMobile } from "../services/utils.js";import { getClosestNtxId } from "../widgets/widget_utils.js";function openContextMenu(notePath: string, e: ContextMenuEvent, viewScope: ViewScope = {}, hoistedNoteId: string | null = null) {contextMenu.show({x: e.pageX,y: e.pageY,- items: getItems(),+ items: getItems(e),selectMenuItemHandler: ({ command }) => handleLinkContextMenuItem(command, e, notePath, viewScope, hoistedNoteId)});}-function getItems(): MenuItem<CommandNames>[] {+function getItems(e: ContextMenuEvent): MenuItem<CommandNames>[] {+ const ntxId = getNtxId(e);+ const isMobileSplitOpen = isMobile() && appContext.tabManager.getNoteContextById(ntxId).getMainContext().getSubContexts().length > 1;+return [{ title: t("link_context_menu.open_note_in_new_tab"), command: "openNoteInNewTab", uiIcon: "bx bx-link-external" },- { title: t("link_context_menu.open_note_in_new_split"), command: "openNoteInNewSplit", uiIcon: "bx bx-dock-right" },+ { title: !isMobileSplitOpen ? t("link_context_menu.open_note_in_new_split") : t("link_context_menu.open_note_in_other_split"), command: "openNoteInNewSplit", uiIcon: "bx bx-dock-right" },{ title: t("link_context_menu.open_note_in_new_window"), command: "openNoteInNewWindow", uiIcon: "bx bx-window-open" },{ title: t("link_context_menu.open_note_in_popup"), command: "openNoteInPopup", uiIcon: "bx bx-edit" }];diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 3a240faf5a..31b1125141 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1883,6 +1883,7 @@"link_context_menu": {"open_note_in_new_tab": "Open note in a new tab","open_note_in_new_split": "Open note in a new split",+ "open_note_in_other_split": "Open note in the other split","open_note_in_new_window": "Open note in a new window","open_note_in_popup": "Quick edit"},