diff --git a/src/hooks/useLinks.hook.ts b/src/hooks/useLinks.hook.ts index 57ea2e4..e9816b8 100644 --- a/src/hooks/useLinks.hook.ts +++ b/src/hooks/useLinks.hook.ts @@ -7,8 +7,6 @@ export const useLinks = (className: string, sha?: string) => { const store = useUserRepoStore() const linkNote: EventListener = (event) => { - event.preventDefault() - event.stopPropagation() const target = event.target as HTMLElement const href = target.getAttribute('href') @@ -16,6 +14,13 @@ export const useLinks = (className: string, sha?: string) => { return } + if (href.startsWith('#')) { + return + } + + event.preventDefault() + event.stopPropagation() + if (isExternalLink(href)) { window.open(href, '_blank') return