File tree Expand file tree Collapse file tree 1 file changed +22
-8
lines changed
src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -50,23 +50,37 @@ export const IFrameViewer = (
50
50
> ,
51
51
) => {
52
52
const url = props . block . props . url ;
53
+ const aspectRatio = props . block . props . aspectRatio || 16 / 9 ;
53
54
54
55
const [ iframeError , setIframeError ] = useState ( false ) ;
55
56
if ( ! url ) {
56
57
return < Box > No URL provided for embed.</ Box > ;
57
58
}
58
59
59
60
return ! iframeError ? (
60
- < iframe
61
- src = { url }
62
- className = "bn-visual-media"
61
+ < div
63
62
style = { {
64
- height : '300px' ,
63
+ position : 'relative' ,
64
+ width : '100%' ,
65
+ paddingTop : `${ 100 / aspectRatio } %` , // padding-top sets height relative to width
65
66
} }
66
- allowFullScreen
67
- title = "Embedded content"
68
- onError = { ( ) => setIframeError ( true ) }
69
- />
67
+ >
68
+ < iframe
69
+ src = { url }
70
+ className = "bn-visual-media"
71
+ style = { {
72
+ position : 'absolute' ,
73
+ top : 0 ,
74
+ left : 0 ,
75
+ width : '100%' ,
76
+ height : '100%' ,
77
+ border : 'none' ,
78
+ } }
79
+ allowFullScreen
80
+ title = "Embedded content"
81
+ onError = { ( ) => setIframeError ( true ) }
82
+ />
83
+ </ div >
70
84
) : (
71
85
< Box
72
86
$css = { css `
You can’t perform that action at this time.
0 commit comments