File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { LiveContext, LivePreview } from 'react-live';
4
4
import qsa from 'dom-helpers/querySelectorAll' ;
5
5
import useIsomorphicEffect from '@restart/hooks/useIsomorphicEffect' ;
6
6
import useMutationObserver from '@restart/hooks/useMutationObserver' ;
7
+ import useEventCallback from '@restart/hooks/useEventCallback' ;
7
8
8
9
export interface PreviewProps {
9
10
className ?: string | undefined ;
@@ -55,9 +56,15 @@ const Preview: React.FC<PreviewProps> = ({ className }) => {
55
56
} ,
56
57
) ;
57
58
59
+ const handleCustomRedirect = useEventCallback ( ( e : React . MouseEvent < HTMLElement > ) => {
60
+ if ( e . target . tagName === 'A' ) {
61
+ e . preventDefault ( ) ;
62
+ }
63
+ } )
64
+
58
65
return (
59
66
< div ref = { exampleRef } >
60
- < LivePreview className = { className } />
67
+ < LivePreview className = { className } onClick = { handleCustomRedirect } />
61
68
</ div >
62
69
) ;
63
70
} ;
You can’t perform that action at this time.
0 commit comments