fix(link): popup menu no longer triggering

This commit is contained in:
Elian Doran 2025-07-11 22:34:41 +03:00
parent 292646e14a
commit f1fc15e115
No known key found for this signature in database

View File

@ -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);