mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-25 07:51:12 +02:00
use local html file for preview in normal mode
This commit is contained in:
@@ -181,7 +181,7 @@ export default class ContentWrap extends Component {
|
|||||||
})
|
})
|
||||||
]).then(writeInsideIframe);
|
]).then(writeInsideIframe);
|
||||||
// Setting to blank string cause frame to reload
|
// Setting to blank string cause frame to reload
|
||||||
// this.frame.src = '';
|
this.frame.src = this.frame.src;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// we need to store user script in external JS file to prevent inline-script
|
// we need to store user script in external JS file to prevent inline-script
|
||||||
@@ -908,11 +908,11 @@ export default class ContentWrap extends Component {
|
|||||||
</SplitPane>
|
</SplitPane>
|
||||||
<div class="demo-side" id="js-demo-side" style="">
|
<div class="demo-side" id="js-demo-side" style="">
|
||||||
<iframe
|
<iframe
|
||||||
src={`${PREVIEW_FRAME_HOST}/preview.html`}
|
src={`./indexpm.html`}
|
||||||
ref={el => (this.frame = el)}
|
ref={el => (this.frame = el)}
|
||||||
frameborder="0"
|
frameborder="0"
|
||||||
id="demo-frame"
|
id="demo-frame"
|
||||||
sandbox="allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation"
|
sandbox="allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups allow-presentation allow-scripts allow-top-navigation-by-user-activation"
|
||||||
allow="accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"
|
allow="accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"
|
||||||
allowpaymentrequest="true"
|
allowpaymentrequest="true"
|
||||||
allowfullscreen="true"
|
allowfullscreen="true"
|
||||||
|
12
src/indexpm.html
Normal file
12
src/indexpm.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<script>
|
||||||
|
function callback(e) {
|
||||||
|
console.log('post message recvd', e.data);
|
||||||
|
window.document.open();
|
||||||
|
|
||||||
|
const { contents } = e.data;
|
||||||
|
window.document.write(e.data.contents);
|
||||||
|
window.document.close();
|
||||||
|
window.addEventListener('message', callback);
|
||||||
|
}
|
||||||
|
window.addEventListener('message', callback);
|
||||||
|
</script>
|
Reference in New Issue
Block a user