@@ -70,36 +70,19 @@ export class NetPyNEPythonConsole extends Component {
7070 return currentNotebookValues ;
7171 }
7272
73+ componentDidUpdate ( prevProps ) {
74+ document . getElementById ( 'pythonConsoleFrame' ) . parentElement . parentElement . style . display = 'block' ;
75+ }
76+
7377 shouldComponentUpdate ( nextProps ) {
74- if ( this . props . extensionLoaded !== nextProps . extensionLoaded ) {
75- return true ;
76- }
77- const iframeStyle = {
78- position : 'absolute' ,
79- left : `${ offScreenLeft } px` ,
80- width : '1px' ,
81- height : '1px' ,
82- } ;
83- var iframeWindow = this . container . contentWindow ;
84- var iframeElement = iframeWindow . frameElement ;
85- var parentDiv = iframeElement . parentElement ;
86- var containerDiv = parentDiv . parentElement ;
87- const offScreenLeft = - window . innerWidth - 100 ; //plus additional buffer just in case
8878
8979 if ( nextProps . notebookVisible )
9080 {
81+ var iframeWindow = this . container . contentWindow ;
9182 iframeWindow . onblur = this . handleIframeBlur ;
9283 iframeWindow . onfocus = this . handleIframeFocus ;
9384 }
94- else {
95- iframeWindow . position = 'absolute' ;
96- iframeWindow . left = `${ offScreenLeft } px` ;
97- iframeWindow . width = '1px' ;
98- iframeWindow . height = '1px' ;
99-
100- containerDiv . style . display = 'block' ;
101- }
102- return false ;
85+ return true ;
10386 }
10487
10588 handleIframeBlur = ( event ) => {
@@ -123,17 +106,10 @@ export class NetPyNEPythonConsole extends Component {
123106
124107 render ( ) {
125108 const notebookName = GEPPETTO_CONFIGURATION . notebookName || "notebook.ipynb" ;
126-
127109 return (
128110 < ReactResizeDetector handleWidth handleHeight >
129- { ( { width, height } ) => (
130- < PythonConsole
131- pythonNotebookPath = { `notebooks/${ notebookName } ` }
132- extensionLoaded = { this . props . extensionLoaded }
133- iframeHeight = { height }
134- />
135- ) }
136- </ ReactResizeDetector >
111+ { ( { width, height } ) => < PythonConsole pythonNotebookPath = { `notebooks/${ notebookName } ` } extensionLoaded = { this . props . extensionLoaded } iframeHeight = { height } /> }
112+ </ ReactResizeDetector >
137113 ) ;
138114 }
139115}
0 commit comments