mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: iframe load to ensure images are loaded
This commit is contained in:
parent
e29af58661
commit
2608ff278b
@ -472,18 +472,15 @@ const iframeLoader = (iframe: HTMLIFrameElement): Promise<HTMLIFrameElement> =>
|
|||||||
|
|
||||||
const documentClone = cloneWindow.document;
|
const documentClone = cloneWindow.document;
|
||||||
|
|
||||||
cloneWindow.onload =
|
cloneWindow.onload = iframe.onload = () => {
|
||||||
iframe.onload =
|
cloneWindow.onload = iframe.onload = null;
|
||||||
documentClone.onreadystatechange =
|
const interval = setInterval(() => {
|
||||||
() => {
|
if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
|
||||||
cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = null;
|
clearInterval(interval);
|
||||||
const interval = setInterval(() => {
|
resolve(iframe);
|
||||||
if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
|
}
|
||||||
clearInterval(interval);
|
}, 50);
|
||||||
resolve(iframe);
|
};
|
||||||
}
|
|
||||||
}, 50);
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user