mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-13 10:06:23 +02:00
add basic detached preview mode. fixes #92
This commit is contained in:
@ -1038,6 +1038,9 @@ customEditorFontInput
|
||||
chrome.i18n.getMessage('@@extension_id') +
|
||||
'/temporary/' +
|
||||
'preview.html';
|
||||
if (scope.detachedWindow) {
|
||||
scope.detachedWindow.postMessage(frame.src, '*');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -1805,6 +1808,25 @@ customEditorFontInput
|
||||
});
|
||||
}
|
||||
|
||||
scope.openDetachedPreview = function() {
|
||||
document.body.classList.add('is-detached-mode');
|
||||
scope.detachedWindow = window.open(
|
||||
'./preview.html',
|
||||
'Web Maker',
|
||||
'width=420,height=230,resizable,scrollbars=yes,status=1'
|
||||
);
|
||||
setTimeout(() => {
|
||||
scope.detachedWindow.postMessage(frame.src, '*');
|
||||
}, 1000);
|
||||
function checkWindow() {
|
||||
if (scope.detachedWindow && scope.detachedWindow.closed) {
|
||||
clearInterval(intervalID);
|
||||
document.body.classList.remove('is-detached-mode');
|
||||
}
|
||||
}
|
||||
var intervalID = window.setInterval(checkWindow, 500);
|
||||
};
|
||||
|
||||
function init() {
|
||||
var lastCode;
|
||||
|
||||
|
Reference in New Issue
Block a user