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 ###
|
||||
|
||||
#### 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 ####
|
||||
* Disable `foreignObjectRendering` by default (#1295)
|
||||
|
@ -177,6 +177,7 @@ export class DocumentCloner {
|
||||
backgroundColor: '#ffffff',
|
||||
canvas: null,
|
||||
imageTimeout: this.options.imageTimeout,
|
||||
logging: this.options.logging,
|
||||
proxy: this.options.proxy,
|
||||
removeContainer: this.options.removeContainer,
|
||||
scale: this.options.scale,
|
||||
|
@ -34,16 +34,8 @@ export default class ResourceLoader {
|
||||
return src;
|
||||
}
|
||||
|
||||
if (isSVG(src)) {
|
||||
if (this.options.allowTaint === true || FEATURES.SUPPORT_SVG_DRAWING) {
|
||||
return this.addImage(src, src, false);
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
this.options.allowTaint === true ||
|
||||
isInlineBase64Image(src) ||
|
||||
this.isSameOrigin(src)
|
||||
) {
|
||||
if (!isSVG(src) || FEATURES.SUPPORT_SVG_DRAWING) {
|
||||
if (this.options.allowTaint === true || isInlineImage(src) || this.isSameOrigin(src)) {
|
||||
return this.addImage(src, src, false);
|
||||
} else if (!this.isSameOrigin(src)) {
|
||||
if (typeof this.options.proxy === 'string') {
|
||||
|
@ -65,6 +65,7 @@ const html2canvas = (element: HTMLElement, conf: ?Options): Promise<*> => {
|
||||
async: true,
|
||||
allowTaint: false,
|
||||
imageTimeout: 15000,
|
||||
logging: true,
|
||||
proxy: null,
|
||||
removeContainer: true,
|
||||
foreignObjectRendering: false,
|
||||
|
@ -15,6 +15,9 @@
|
||||
<h1>External image</h1>
|
||||
<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>
|
||||
<img src="/assets/image_1.jpg" />
|
||||
</body>
|
||||
|
@ -16,5 +16,6 @@
|
||||
<body>
|
||||
<h1>External image (CORS)</h1>
|
||||
<img src="http://localhost:8081/cors/tests/assets/image2.jpg" />
|
||||
<img src="http://localhost:8081/cors/tests/assets/image.svg" />
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user