mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
parent
2e95e60df7
commit
8e37e3ce5c
@ -5,6 +5,7 @@ import {
|
|||||||
isElementNode,
|
isElementNode,
|
||||||
isHTMLElementNode,
|
isHTMLElementNode,
|
||||||
isIFrameElement,
|
isIFrameElement,
|
||||||
|
isImageElement,
|
||||||
isScriptElement,
|
isScriptElement,
|
||||||
isSelectElement,
|
isSelectElement,
|
||||||
isStyleElement,
|
isStyleElement,
|
||||||
@ -128,7 +129,15 @@ export class DocumentCloner {
|
|||||||
return this.createStyleClone(node);
|
return this.createStyleClone(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
return node.cloneNode(false) as HTMLElement;
|
const clone = node.cloneNode(false) as HTMLElement;
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
if (isImageElement(clone) && clone.loading === 'lazy') {
|
||||||
|
// @ts-ignore
|
||||||
|
clone.loading = 'eager';
|
||||||
|
}
|
||||||
|
|
||||||
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
createStyleClone(node: HTMLStyleElement): HTMLStyleElement {
|
createStyleClone(node: HTMLStyleElement): HTMLStyleElement {
|
||||||
|
@ -25,7 +25,7 @@ const html2canvas = (element: HTMLElement, options: Partial<Options> = {}): Prom
|
|||||||
|
|
||||||
export default html2canvas;
|
export default html2canvas;
|
||||||
|
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== 'undefined') {
|
||||||
CacheStorage.setContext(window);
|
CacheStorage.setContext(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<img src="../../assets/image.jpg" />
|
<img src="../../assets/image.jpg" />
|
||||||
|
<img src="../../assets/image.jpg" loading="lazy" />
|
||||||
<img src="../../assets/image.jpg" style="width:50px;height:400px;" />
|
<img src="../../assets/image.jpg" style="width:50px;height:400px;" />
|
||||||
<img src="../../assets/image.jpg" style="width:500px;" />
|
<img src="../../assets/image.jpg" style="width:500px;" />
|
||||||
<img src="../../assets/image.jpg" style="width:100px;border-radius:50px;" />
|
<img src="../../assets/image.jpg" style="width:100px;border-radius:50px;" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user