From cb4ecd781bbbcd16bdc8e4bd52bed905537ef947 Mon Sep 17 00:00:00 2001 From: "CirnoV (Sickle)" Date: Thu, 5 Dec 2024 19:08:33 +0900 Subject: [PATCH] =?UTF-8?q?REST=20API=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=83=88=20=EC=B0=BD=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=97=B4=EA=B8=B0=20=EB=8F=99=EC=9E=91(ctrl=20+=20click)=20?= =?UTF-8?q?=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/rest-api/category/index.tsx | 7 +++++++ src/layouts/rest-api/category/type-def.tsx | 3 +++ src/layouts/rest-api/misc/ApiLink.tsx | 5 ++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/layouts/rest-api/category/index.tsx b/src/layouts/rest-api/category/index.tsx index 58d5c0c24..03019ab36 100644 --- a/src/layouts/rest-api/category/index.tsx +++ b/src/layouts/rest-api/category/index.tsx @@ -101,6 +101,13 @@ export function Category(props: CategoryProps) { "opacity-50": endpoint.deprecated || endpoint.unstable, }} onClick={(e) => { + if ( + e.ctrlKey || + e.metaKey || + e.shiftKey || + e.button !== 0 + ) + return; e.preventDefault(); expandAndScrollTo({ section: props.section, diff --git a/src/layouts/rest-api/category/type-def.tsx b/src/layouts/rest-api/category/type-def.tsx index fb8ed1989..b4f58b5ab 100644 --- a/src/layouts/rest-api/category/type-def.tsx +++ b/src/layouts/rest-api/category/type-def.tsx @@ -66,6 +66,8 @@ export function TypeDefinitions(props: TypeDefinitionsProps) { class="underline-offset-4 transition-colors hover:text-orange-5 hover:underline" href={href} onClick={(e) => { + if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) + return; e.preventDefault(); expandAndScrollTo({ section: "type-def", @@ -510,6 +512,7 @@ function TypeReprDoc(props: TypeReprDocProps) { class="inline-block text-green-6 font-bold underline-offset-4 transition-colors hover:text-orange-5 hover:underline" href={href()} onClick={(e) => { + if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return; e.preventDefault(); expandAndScrollTo({ section: "type-def", diff --git a/src/layouts/rest-api/misc/ApiLink.tsx b/src/layouts/rest-api/misc/ApiLink.tsx index b80b192dc..478199f5e 100644 --- a/src/layouts/rest-api/misc/ApiLink.tsx +++ b/src/layouts/rest-api/misc/ApiLink.tsx @@ -19,13 +19,12 @@ export default function ApiLink({ }: ApiLinkProps) { const id = getEndpointRepr({ method, path }); const href = `${basepath}/${section}#${encodeURIComponent(id)}`; - const className = - "hover:text-orange-5 hover:border-orange-2 border-b-2 transition-colors"; return ( { + if (e.ctrlKey || e.metaKey || e.shiftKey || e.button !== 0) return; e.preventDefault(); expandAndScrollTo({ section, href, id }); }}