mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +01:00
Remove other listener
This commit is contained in:
parent
a1358dccbc
commit
87be1e4ff6
@ -1,4 +1,3 @@
|
||||
import { MouseEventType } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { AddEventLinkTracker, GetConfiguration, NotificationUtilities, RemoveLinkEventTracker } from '../../api';
|
||||
import { Base, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common';
|
||||
@ -29,17 +28,6 @@ export const NitropediaView: FC<{}> = props =>
|
||||
});
|
||||
}, []);
|
||||
|
||||
const onClick = useCallback((event: MouseEvent) =>
|
||||
{
|
||||
if(!(event.target instanceof HTMLAnchorElement)) return;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
const link = event.target.href;
|
||||
|
||||
NotificationUtilities.openUrl(link);
|
||||
}, []);
|
||||
|
||||
const onLinkReceived = useCallback((link: string) =>
|
||||
{
|
||||
const value = link.split('/');
|
||||
@ -60,17 +48,6 @@ export const NitropediaView: FC<{}> = props =>
|
||||
return () => RemoveLinkEventTracker(linkTracker);
|
||||
}, [ onLinkReceived ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
const element = elementRef.current;
|
||||
|
||||
if(!element) return;
|
||||
|
||||
element.addEventListener(MouseEventType.MOUSE_CLICK, onClick);
|
||||
|
||||
return () => element.removeEventListener(MouseEventType.MOUSE_CLICK, onClick);
|
||||
}, [ onClick, content ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
const handle = (event: MouseEvent) =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user