diff --git a/apps/client/src/menus/link_context_menu.ts b/apps/client/src/menus/link_context_menu.ts index 561a44efa..a8de83883 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[] { +function getItems(e: ContextMenuEvent): MenuItem[] { + 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.json index 3a240faf5..31b112514 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" },