1
+ import { useRef } from 'react'
2
+
1
3
import {
2
4
Button ,
3
5
ButtonComponentType ,
@@ -18,12 +20,15 @@ export const SidePanelDocumentation = ({ onClose }: SidePanelDocumentationProps)
18
20
sidePanelConfig : { docLink } ,
19
21
} = useMainContext ( )
20
22
23
+ // REFS
24
+ const iframeRef = useRef < HTMLIFrameElement | null > ( null )
25
+
21
26
// CONSTANTS
22
27
const iframeSrc = `${ docLink } &theme=${ appTheme } `
23
28
24
29
return (
25
30
< >
26
- < div className = "px-16 pt-14 pb-13 border__primary--bottom flex dc__gap-12" >
31
+ < div className = "px-16 pt-12 pb-11 border__primary--bottom flex dc__gap-12" >
27
32
< Icon name = "ic-book-open" color = "N900" />
28
33
< h2 className = "m-0 fs-16 lh-1-5 fw-6 cn-9 flex-grow-1" > Documentation</ h2 >
29
34
< div className = "flex dc__gap-8" >
@@ -36,7 +41,10 @@ export const SidePanelDocumentation = ({ onClose }: SidePanelDocumentationProps)
36
41
size = { ComponentSizeType . xs }
37
42
component = { ButtonComponentType . anchor }
38
43
anchorProps = { {
39
- href : docLink ,
44
+ href :
45
+ iframeRef . current ?. contentDocument ?. referrer ??
46
+ iframeRef . current ?. contentWindow ?. location ?. href ??
47
+ docLink ,
40
48
} }
41
49
/>
42
50
< Button
@@ -55,14 +63,15 @@ export const SidePanelDocumentation = ({ onClose }: SidePanelDocumentationProps)
55
63
{ docLink && (
56
64
< iframe
57
65
key = { iframeSrc }
66
+ ref = { iframeRef }
58
67
title = "side-panel-documentation"
59
68
loading = "lazy"
60
69
className = "dc__no-border"
61
70
src = { iframeSrc }
62
71
width = "100%"
63
72
height = "100%"
64
73
allow = "clipboard-read; clipboard-write"
65
- sandbox = "allow-same-origin allow-scripts"
74
+ sandbox = "allow-same-origin allow-scripts allow-popups "
66
75
referrerPolicy = "no-referrer"
67
76
/>
68
77
) }
0 commit comments