File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,20 @@ export class JupyterEdit extends Component {
3333
3434 componentDidMount ( ) {
3535 window . addEventListener ( 'message' , this . onMessage )
36+ if ( this . props . receiveInterceptorUpdate ) {
37+ this . activateInterceptor ( true )
38+ }
3639 }
3740
3841 componentDidUpdate ( prevProps ) {
3942 if ( this . props . appid !== prevProps . appid ) {
4043 this . activateApp ( )
4144 }
45+ if (
46+ this . props . receiveInterceptorUpdate !== prevProps . receiveInterceptorUpdate
47+ ) {
48+ this . activateInterceptor ( ! ! this . props . receiveInterceptorUpdate )
49+ }
4250 }
4351
4452 componentWillUnmount ( ) {
@@ -107,6 +115,13 @@ export class JupyterEdit extends Component {
107115 } )
108116 }
109117
118+ activateInterceptor ( activate ) {
119+ return this . sendToIFrameAndReceive ( {
120+ type : 'activateInterceptor' ,
121+ activate
122+ } )
123+ }
124+
110125 onMessage ( event ) {
111126 if ( event . origin !== new URL ( jupyterurl ) . origin ) return
112127 const data = event . data
@@ -174,6 +189,12 @@ export class JupyterEdit extends Component {
174189 case 'reportKernelStatus' :
175190 this . props ?. kernelStatusCallback ?. ( data . status )
176191 break
192+ case 'sendInterceptorUpdate' :
193+ {
194+ const { path, mime, state } = data
195+ this . props ?. receiveInterceptorUpdate ?. ( { path, mime, state } )
196+ }
197+ break
177198 default :
178199 }
179200 }
You can’t perform that action at this time.
0 commit comments