File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class Gist extends React.PureComponent {
19
19
}
20
20
21
21
_updateIframeContent ( ) {
22
- const { id } = this . props ;
22
+ const { id, file } = this . props ;
23
23
24
24
const iframe = this . iframeNode ;
25
25
@@ -30,7 +30,8 @@ class Gist extends React.PureComponent {
30
30
const gistLink = this . _defineUrl ( )
31
31
const gistScript = `<script type="text/javascript" src="${ gistLink } "></script>` ;
32
32
const styles = '<style>*{font-size:12px;}</style>' ;
33
- const resizeScript = `onload="parent.document.getElementById('gist-${ id } ').style.height=document.body.scrollHeight + 'px'"` ;
33
+ const elementId = file ? `gist-${ id } -${ file } ` : `gist-${ id } ` ;
34
+ const resizeScript = `onload="parent.document.getElementById('${ elementId } ').style.height=document.body.scrollHeight + 'px'"` ;
34
35
const iframeHtml = `<html><head><base target="_parent">${ styles } </head><body ${ resizeScript } >${ gistScript } </body></html>` ;
35
36
36
37
doc . open ( ) ;
@@ -39,14 +40,14 @@ class Gist extends React.PureComponent {
39
40
}
40
41
41
42
render ( ) {
42
- const { id } = this . props ;
43
+ const { id, file } = this . props ;
43
44
44
45
return (
45
46
< iframe
46
47
ref = { ( n ) => { this . iframeNode = n ; } }
47
48
width = "100%"
48
49
frameBorder = { 0 }
49
- id = { `gist-${ id } ` }
50
+ id = { file ? `gist- ${ id } - ${ file } ` : `gist-${ id } ` }
50
51
/>
51
52
) ;
52
53
}
You can’t perform that action at this time.
0 commit comments