From 4b1af35b3946fc0ffcec360ecc1e69d9ebfb74d8 Mon Sep 17 00:00:00 2001 From: Free Date: Wed, 22 Mar 2023 18:50:30 +0000 Subject: [PATCH] Allows ctrl+clicking internal links (#9603) (#9743) Co-authored-by: Freeplay Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9743 Co-authored-by: Free Co-committed-by: Free --- packages/client/src/components/global/MkA.vue | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/client/src/components/global/MkA.vue b/packages/client/src/components/global/MkA.vue index a75cd34299..6619827876 100644 --- a/packages/client/src/components/global/MkA.vue +++ b/packages/client/src/components/global/MkA.vue @@ -1,5 +1,5 @@ @@ -80,23 +80,27 @@ function popout() { } function nav(ev: MouseEvent) { - if (props.behavior === 'browser') { - location.href = props.to; - return; - } + if (!ev.ctrlKey) { + ev.preventDefault(); - if (props.behavior) { - if (props.behavior === 'window') { - return openWindow(); - } else if (props.behavior === 'modalWindow') { - return modalWindow(); + if (props.behavior === 'browser') { + location.href = props.to; + return; } - } - if (ev.shiftKey) { - return openWindow(); - } + if (props.behavior) { + if (props.behavior === 'window') { + return openWindow(); + } else if (props.behavior === 'modalWindow') { + return modalWindow(); + } + } - router.push(props.to, ev.ctrlKey ? 'forcePage' : null); + if (ev.shiftKey) { + return openWindow(); + } + + router.push(props.to, ev.ctrlKey ? 'forcePage' : null); + } }