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

refactor console position in detached mode. fixes #319

This commit is contained in:
Kushagra Gour
2018-09-29 18:18:54 +05:30
parent e1426b9385
commit bc8ad6d7ad
3 changed files with 16 additions and 12 deletions

View File

@@ -549,6 +549,7 @@ export default class ContentWrap extends Component {
trackEvent('ui', 'updateCodeMode', mode);
}
}
detachPreview() {
if (this.detachedWindow) {
this.detachedWindow.focus();
@@ -558,7 +559,6 @@ export default class ContentWrap extends Component {
const iframeWidth = iframeBounds.width;
const iframeHeight = iframeBounds.height;
document.body.classList.add('is-detached-mode');
window.globalConsoleContainerEl.insertBefore(window.consoleEl, null);
this.detachedWindow = window.open(
'./preview.html',
@@ -574,7 +574,6 @@ export default class ContentWrap extends Component {
if (this.detachedWindow && this.detachedWindow.closed) {
clearInterval(intervalID);
document.body.classList.remove('is-detached-mode');
$('#js-demo-side').insertBefore(window.consoleEl, null);
this.detachedWindow = null;
// Update main frame preview to get latest changes (which were not
// getting reflected while detached window was open)