mirror of
https://github.com/chinchang/web-maker.git
synced 2025-02-23 14:44:53 +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()
|
||||
};
|
||||
utils.log('🔎 setPreviewContent', isForced);
|
||||
const targetFrame = scope.detachedWindow ? scope.detachedWindow : frame;
|
||||
|
||||
// If just CSS was changed (and everything shudn't be empty),
|
||||
// change the styles inside the iframe.
|
||||
if (
|
||||
@ -1098,8 +1100,8 @@ globalConsoleContainerEl
|
||||
currentCode.js === codeInPreview.js
|
||||
) {
|
||||
computeCss().then(function(css) {
|
||||
if (frame.contentDocument.querySelector('#webmakerstyle')) {
|
||||
frame.contentDocument.querySelector(
|
||||
if (targetFrame.contentDocument.querySelector('#webmakerstyle')) {
|
||||
targetFrame.contentDocument.querySelector(
|
||||
'#webmakerstyle'
|
||||
).textContent = css;
|
||||
}
|
||||
@ -1903,6 +1905,8 @@ globalConsoleContainerEl
|
||||
document.body.classList.remove('is-detached-mode');
|
||||
$('#js-demo-side').insertBefore(consoleEl, null);
|
||||
scope.detachedWindow = null;
|
||||
// Update main frame preview
|
||||
scope.setPreviewContent(true);
|
||||
}
|
||||
}
|
||||
var intervalID = window.setInterval(checkWindow, 500);
|
||||
|
Loading…
x
Reference in New Issue
Block a user