mirror of
https://github.com/chinchang/web-maker.git
synced 2025-05-14 14:25:29 +02:00
focus detached window if already present and size it same as iframe. fixes #92
This commit is contained in:
parent
afd491b543
commit
748c8a0b00
@ -1856,11 +1856,19 @@ customEditorFontInput, cssSettingsModal, cssSettingsBtn, acssSettingsTextarea
|
|||||||
}
|
}
|
||||||
|
|
||||||
scope.openDetachedPreview = function() {
|
scope.openDetachedPreview = function() {
|
||||||
|
if (scope.detachedWindow) {
|
||||||
|
scope.detachedWindow.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var iframeBounds = frame.getBoundingClientRect();
|
||||||
|
const iframeWidth = iframeBounds.width;
|
||||||
|
const iframeHeight = iframeBounds.height;
|
||||||
document.body.classList.add('is-detached-mode');
|
document.body.classList.add('is-detached-mode');
|
||||||
|
|
||||||
scope.detachedWindow = window.open(
|
scope.detachedWindow = window.open(
|
||||||
'./preview.html',
|
'./preview.html',
|
||||||
'Web Maker',
|
'Web Maker',
|
||||||
'width=420,height=230,resizable,scrollbars=yes,status=1'
|
`width=${iframeWidth},height=${iframeHeight},resizable,scrollbars=yes,status=1`
|
||||||
);
|
);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
scope.detachedWindow.postMessage(frame.src, '*');
|
scope.detachedWindow.postMessage(frame.src, '*');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user