1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-28 01:00:13 +02:00

files mode detached mode working, separate domain and logging refactor

This commit is contained in:
Kushagra Gour
2019-02-28 16:51:08 +05:30
parent 53533bf09a
commit 1d88db8e10
4 changed files with 90 additions and 17 deletions

View File

@@ -69,6 +69,11 @@ export default class ContentWrap extends Component {
}
componentDidMount() {
this.props.onRef(this);
window.addEventListener('message', e => {
if (e.data && e.data.logs) {
this.onMessageFromConsole(...e.data.logs);
}
});
}
onHtmlCodeChange(editor, change) {
@@ -160,7 +165,7 @@ export default class ContentWrap extends Component {
: `${location.origin}`;
var src = `filesystem:${origin}/temporary/preview.html`;
if (this.detachedWindow) {
this.detachedWindow.postMessage(src, '*');
this.detachedWindow.postMessage({ url: src }, '*');
} else {
this.frame.src = src;
}