mirror of
https://github.com/chinchang/web-maker.git
synced 2025-02-23 22:53:18 +01:00
prevent double console logs in detached mode. fixes #223
This commit is contained in:
parent
8e987d6cb3
commit
18484fdfcb
@ -1090,6 +1090,8 @@ globalConsoleContainerEl
|
|||||||
js: scope.cm.js.getValue()
|
js: scope.cm.js.getValue()
|
||||||
};
|
};
|
||||||
utils.log('🔎 setPreviewContent', isForced);
|
utils.log('🔎 setPreviewContent', isForced);
|
||||||
|
const targetFrame = scope.detachedWindow ? scope.detachedWindow : frame;
|
||||||
|
|
||||||
// If just CSS was changed (and everything shudn't be empty),
|
// If just CSS was changed (and everything shudn't be empty),
|
||||||
// change the styles inside the iframe.
|
// change the styles inside the iframe.
|
||||||
if (
|
if (
|
||||||
@ -1098,8 +1100,8 @@ globalConsoleContainerEl
|
|||||||
currentCode.js === codeInPreview.js
|
currentCode.js === codeInPreview.js
|
||||||
) {
|
) {
|
||||||
computeCss().then(function(css) {
|
computeCss().then(function(css) {
|
||||||
if (frame.contentDocument.querySelector('#webmakerstyle')) {
|
if (targetFrame.contentDocument.querySelector('#webmakerstyle')) {
|
||||||
frame.contentDocument.querySelector(
|
targetFrame.contentDocument.querySelector(
|
||||||
'#webmakerstyle'
|
'#webmakerstyle'
|
||||||
).textContent = css;
|
).textContent = css;
|
||||||
}
|
}
|
||||||
@ -1903,6 +1905,8 @@ globalConsoleContainerEl
|
|||||||
document.body.classList.remove('is-detached-mode');
|
document.body.classList.remove('is-detached-mode');
|
||||||
$('#js-demo-side').insertBefore(consoleEl, null);
|
$('#js-demo-side').insertBefore(consoleEl, null);
|
||||||
scope.detachedWindow = null;
|
scope.detachedWindow = null;
|
||||||
|
// Update main frame preview
|
||||||
|
scope.setPreviewContent(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var intervalID = window.setInterval(checkWindow, 500);
|
var intervalID = window.setInterval(checkWindow, 500);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user