mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
fix(link): popup menu no longer triggering
This commit is contained in:
parent
292646e14a
commit
f1fc15e115
@ -308,15 +308,15 @@ function goToLinkExt(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent
|
|||||||
const ctrlKey = evt && utils.isCtrlKey(evt);
|
const ctrlKey = evt && utils.isCtrlKey(evt);
|
||||||
const shiftKey = evt?.shiftKey;
|
const shiftKey = evt?.shiftKey;
|
||||||
const isLeftClick = !evt || ("which" in evt && evt.which === 1);
|
const isLeftClick = !evt || ("which" in evt && evt.which === 1);
|
||||||
|
// Right click is handled separately.
|
||||||
const isMiddleClick = evt && "which" in evt && evt.which === 2;
|
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 targetIsBlank = ($link?.attr("target") === "_blank");
|
||||||
const openInNewTab = (isLeftClick && ctrlKey) || isMiddleClick || targetIsBlank;
|
const openInNewTab = (isLeftClick && ctrlKey) || isMiddleClick || targetIsBlank;
|
||||||
const activate = (isLeftClick && ctrlKey && shiftKey) || (isMiddleClick && shiftKey);
|
const activate = (isLeftClick && ctrlKey && shiftKey) || (isMiddleClick && shiftKey);
|
||||||
const openInNewWindow = isLeftClick && evt?.shiftKey && !ctrlKey;
|
const openInNewWindow = isLeftClick && evt?.shiftKey && !ctrlKey;
|
||||||
|
|
||||||
if (notePath) {
|
if (notePath) {
|
||||||
if (openInPopup || (ctrlKey && isRightClick)) {
|
if (openInPopup) {
|
||||||
appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath });
|
appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath });
|
||||||
} else if (openInNewWindow) {
|
} else if (openInNewWindow) {
|
||||||
appContext.triggerCommand("openInWindow", { notePath, viewScope });
|
appContext.triggerCommand("openInWindow", { notePath, viewScope });
|
||||||
@ -388,17 +388,18 @@ function linkContextMenu(e: PointerEvent) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.button === 2) {
|
|
||||||
e.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { notePath, viewScope } = parseNavigationStateFromUrl(url);
|
const { notePath, viewScope } = parseNavigationStateFromUrl(url);
|
||||||
|
|
||||||
if (!notePath) {
|
if (!notePath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.ctrlKey && e.button === 2) {
|
||||||
|
appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath });
|
||||||
|
e.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
linkContextMenuService.openContextMenu(notePath, e, viewScope, null);
|
linkContextMenuService.openContextMenu(notePath, e, viewScope, null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user