fix: cmd+click on share links should redirect to shared url.

closes #6937
This commit is contained in:
Tom Moor
2024-05-27 11:38:38 -04:00
parent 1f097258f4
commit 3d8daa1d8c

View File

@@ -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]