From f1fc15e115477fd9ef9388303e4d670b1a697a64 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 11 Jul 2025 22:34:41 +0300 Subject: [PATCH] fix(link): popup menu no longer triggering --- apps/client/src/services/link.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/client/src/services/link.ts b/apps/client/src/services/link.ts index c87332464..92261d172 100644 --- a/apps/client/src/services/link.ts +++ b/apps/client/src/services/link.ts @@ -308,15 +308,15 @@ function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent const ctrlKey = evt && utils.isCtrlKey(evt); const shiftKey = evt?.shiftKey; const isLeftClick = !evt || ("which" in evt && evt.which === 1); + // Right click is handled separately. const isMiddleClick = evt && "which" in evt && evt.which === 2; - const isRightClick = evt && "button" in evt && evt.button === 2; const targetIsBlank = ($link?.attr("target") === "_blank"); const openInNewTab = (isLeftClick && ctrlKey) || isMiddleClick || targetIsBlank; const activate = (isLeftClick && ctrlKey && shiftKey) || (isMiddleClick && shiftKey); const openInNewWindow = isLeftClick && evt?.shiftKey && !ctrlKey; if (notePath) { - if (openInPopup || (ctrlKey && isRightClick)) { + if (openInPopup) { appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath }); } else if (openInNewWindow) { appContext.triggerCommand("openInWindow", { notePath, viewScope }); @@ -388,17 +388,18 @@ function linkContextMenu(e: PointerEvent) { return; } - if (e.button === 2) { - e.preventDefault(); - return; - } - const { notePath, viewScope } = parseNavigationStateFromUrl(url); if (!notePath) { return; } + if (e.ctrlKey && e.button === 2) { + appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath }); + e.preventDefault(); + return; + } + e.preventDefault(); linkContextMenuService.openContextMenu(notePath, e, viewScope, null);