🐛 (link) anchor links have default use

This commit is contained in:
Julien Calixte
2021-12-11 21:52:31 +01:00
parent 3acdb3a407
commit c569bde6d0

View File

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