chromesetting
杨树明 5 years ago
parent 457267c255
commit 838a590074

@ -31,19 +31,15 @@ document.addEventListener('keydown', (e) => {
window.parent.postMessage('jupytermessage','*'); window.parent.postMessage('jupytermessage','*');
} }
}); });
})
$(function(){
window.addEventListener('message', (e) => { window.addEventListener('message', (e) => {
console.log("触发了Parentwindow");
console.log(e);
if(e){ if(e){
if(e.data){ if(e.data){
if(e.data==="Parentwindow"){ if(e.data==="stopParent"){
//重置停止 //重置停止
timebool=false; timebool=false;
console.log("父窗口调我了"); }else if(e.data==="clonsParent"){
}else if(e.data==="Parentwindow"){
console.log("父窗口调我了");
//取消启动 //取消启动
timebool=true; timebool=true;
this.runEvery10Sec(); this.runEvery10Sec();
@ -53,5 +49,6 @@ $(function(){
} }
}); });
}) })

@ -135,6 +135,14 @@ function JupyterTPI (props) {
// 重置实训 // 重置实训
const handleClickResetTpi = () => { const handleClickResetTpi = () => {
var _iframe = document.getElementById("rightPaneframe");
if(_iframe == null || _iframe == undefined || _iframe == ""){
return;
}
_iframe.contentWindow.postMessage("stopParent", "*");
Modal.confirm({ Modal.confirm({
title: '重置实训', title: '重置实训',
content: ( content: (
@ -150,7 +158,10 @@ function JupyterTPI (props) {
if (myIdentifier) { if (myIdentifier) {
syncJupyterCode(myIdentifier, '重置成功'); syncJupyterCode(myIdentifier, '重置成功');
} }
} },
onCancel() {
_iframe.contentWindow.postMessage("clonsParent", "*");
},
}) })
} }

@ -58,6 +58,7 @@ function RightPane (props) {
<div className="jupyter_result"> <div className="jupyter_result">
<div className="jupyter_iframe"> <div className="jupyter_iframe">
<iframe <iframe
id={"rightPaneframe"}
title=" " title=" "
width="100%" width="100%"
height="100%" height="100%"

Loading…
Cancel
Save