mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix canvas rendering on Chrome
This commit is contained in:
parent
e1d6b4c76f
commit
38749bc4b6
@ -97,16 +97,6 @@ export const renderElement = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return resourceLoader.ready().then(imageStore => {
|
return resourceLoader.ready().then(imageStore => {
|
||||||
if (options.removeContainer === true) {
|
|
||||||
if (container.parentNode) {
|
|
||||||
container.parentNode.removeChild(container);
|
|
||||||
} else if (__DEV__) {
|
|
||||||
logger.log(
|
|
||||||
`Cannot detach cloned iframe as it is not in the DOM anymore`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fontMetrics = new FontMetrics(clonedDocument);
|
const fontMetrics = new FontMetrics(clonedDocument);
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
logger.log(`Starting renderer`);
|
logger.log(`Starting renderer`);
|
||||||
@ -133,7 +123,18 @@ export const renderElement = (
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const renderer = new Renderer(options.target, renderOptions);
|
const renderer = new Renderer(options.target, renderOptions);
|
||||||
return renderer.render(stack);
|
const canvas = renderer.render(stack);
|
||||||
|
if (options.removeContainer === true) {
|
||||||
|
if (container.parentNode) {
|
||||||
|
container.parentNode.removeChild(container);
|
||||||
|
} else if (__DEV__) {
|
||||||
|
logger.log(
|
||||||
|
`Cannot detach cloned iframe as it is not in the DOM anymore`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return canvas;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user