mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
11 lines
333 B
TypeScript
11 lines
333 B
TypeScript
import { isOpenInNewWindowClick } from './general'
|
|
import { loadWithPJAX } from './hooks/usePJAX'
|
|
|
|
export function createAnchorClickHandler(url: string) {
|
|
return (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
|
if (isOpenInNewWindowClick(e)) return
|
|
|
|
e.preventDefault()
|
|
loadWithPJAX(url, e.currentTarget)
|
|
}
|
|
}
|