From 3d8daa1d8ce9aeacba9942b0ea92b20aa0d4469e Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 27 May 2024 11:38:38 -0400 Subject: [PATCH] fix: cmd+click on share links should redirect to shared url. closes #6937 --- app/hooks/useEditorClickHandlers.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/hooks/useEditorClickHandlers.ts b/app/hooks/useEditorClickHandlers.ts index 5c8f82a9d..701292ca3 100644 --- a/app/hooks/useEditorClickHandlers.ts +++ b/app/hooks/useEditorClickHandlers.ts @@ -20,10 +20,9 @@ export default function useEditorClickHandlers({ shareId }: Params) { return; } - if (isInternalUrl(href) && !isModKey(event) && !event.shiftKey) { - // relative - let navigateTo = href; + let navigateTo = href; + if (isInternalUrl(href)) { // probably absolute if (href[0] !== "/") { try { @@ -51,10 +50,12 @@ export default function useEditorClickHandlers({ shareId }: Params) { if (shareId && navigateTo.includes("/doc/")) { navigateTo = sharedDocumentPath(shareId, navigateTo); } + } + if (!isModKey(event) && !event.shiftKey) { history.push(navigateTo); - } else if (href) { - window.open(href, "_blank"); + } else { + window.open(navigateTo, "_blank"); } }, [history, shareId]