From 67775311b8d5a49e9e1083ef0d43507a73cf296f Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 17 Mar 2022 13:41:31 -0400 Subject: [PATCH] Possible event: click fix --- src/components/nitropedia/NitropediaView.tsx | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/components/nitropedia/NitropediaView.tsx b/src/components/nitropedia/NitropediaView.tsx index 5baf57f9..78d165ae 100644 --- a/src/components/nitropedia/NitropediaView.tsx +++ b/src/components/nitropedia/NitropediaView.tsx @@ -71,6 +71,27 @@ export const NitropediaView: FC<{}> = props => return () => element.removeEventListener(MouseEventType.MOUSE_CLICK, onClick); }, [ onClick, content ]); + useEffect(() => + { + const handle = (event: MouseEvent) => + { + if(!(event.target instanceof HTMLAnchorElement)) return; + + const link = event.target.href; + + if(!link || !link.length) return; + + NotificationUtilities.openUrl(link); + } + + document.addEventListener('click', handle); + + return () => + { + document.removeEventListener('click', handle); + } + }, []); + if(!content) return null; return (