mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix external SVG loading with proxies (#802)
This commit is contained in:
parent
d87fef11a4
commit
50608e9cd4
@ -1,6 +1,9 @@
|
|||||||
### Changelog ###
|
### Changelog ###
|
||||||
|
|
||||||
#### v1.0.0-alpha4 - TBD ####
|
#### v1.0.0-alpha4 - TBD ####
|
||||||
|
* Fix logging option (#1302)
|
||||||
|
* Add support for rendering webgl canvas content (#646)
|
||||||
|
* Fix external SVG loading with proxies (#802)
|
||||||
|
|
||||||
#### v1.0.0-alpha3 - 9.12.2017 ####
|
#### v1.0.0-alpha3 - 9.12.2017 ####
|
||||||
* Disable `foreignObjectRendering` by default (#1295)
|
* Disable `foreignObjectRendering` by default (#1295)
|
||||||
|
@ -177,6 +177,7 @@ export class DocumentCloner {
|
|||||||
backgroundColor: '#ffffff',
|
backgroundColor: '#ffffff',
|
||||||
canvas: null,
|
canvas: null,
|
||||||
imageTimeout: this.options.imageTimeout,
|
imageTimeout: this.options.imageTimeout,
|
||||||
|
logging: this.options.logging,
|
||||||
proxy: this.options.proxy,
|
proxy: this.options.proxy,
|
||||||
removeContainer: this.options.removeContainer,
|
removeContainer: this.options.removeContainer,
|
||||||
scale: this.options.scale,
|
scale: this.options.scale,
|
||||||
|
@ -34,16 +34,8 @@ export default class ResourceLoader {
|
|||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSVG(src)) {
|
if (!isSVG(src) || FEATURES.SUPPORT_SVG_DRAWING) {
|
||||||
if (this.options.allowTaint === true || FEATURES.SUPPORT_SVG_DRAWING) {
|
if (this.options.allowTaint === true || isInlineImage(src) || this.isSameOrigin(src)) {
|
||||||
return this.addImage(src, src, false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (
|
|
||||||
this.options.allowTaint === true ||
|
|
||||||
isInlineBase64Image(src) ||
|
|
||||||
this.isSameOrigin(src)
|
|
||||||
) {
|
|
||||||
return this.addImage(src, src, false);
|
return this.addImage(src, src, false);
|
||||||
} else if (!this.isSameOrigin(src)) {
|
} else if (!this.isSameOrigin(src)) {
|
||||||
if (typeof this.options.proxy === 'string') {
|
if (typeof this.options.proxy === 'string') {
|
||||||
|
@ -65,6 +65,7 @@ const html2canvas = (element: HTMLElement, conf: ?Options): Promise<*> => {
|
|||||||
async: true,
|
async: true,
|
||||||
allowTaint: false,
|
allowTaint: false,
|
||||||
imageTimeout: 15000,
|
imageTimeout: 15000,
|
||||||
|
logging: true,
|
||||||
proxy: null,
|
proxy: null,
|
||||||
removeContainer: true,
|
removeContainer: true,
|
||||||
foreignObjectRendering: false,
|
foreignObjectRendering: false,
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
<h1>External image</h1>
|
<h1>External image</h1>
|
||||||
<img src="http://localhost:8081/assets/image2.jpg" style="border:5px solid black;" />
|
<img src="http://localhost:8081/assets/image2.jpg" style="border:5px solid black;" />
|
||||||
|
|
||||||
|
<h1>External svg image</h1>
|
||||||
|
<img src="http://localhost:8081/assets/image.svg" style="border:5px solid black;" />
|
||||||
|
|
||||||
<h1>External image (using <base> href)</h1>
|
<h1>External image (using <base> href)</h1>
|
||||||
<img src="/assets/image_1.jpg" />
|
<img src="/assets/image_1.jpg" />
|
||||||
</body>
|
</body>
|
||||||
|
@ -16,5 +16,6 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1>External image (CORS)</h1>
|
<h1>External image (CORS)</h1>
|
||||||
<img src="http://localhost:8081/cors/tests/assets/image2.jpg" />
|
<img src="http://localhost:8081/cors/tests/assets/image2.jpg" />
|
||||||
|
<img src="http://localhost:8081/cors/tests/assets/image.svg" />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user