mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Add onclone callback option to allow modifying cloned document prior to rendering
This commit is contained in:
@ -45,7 +45,10 @@ function renderDocument(document, options, windowWidth, windowHeight) {
|
||||
document.querySelector(selector).removeAttribute(html2canvasNodeAttribute);
|
||||
var clonedWindow = container.contentWindow;
|
||||
var node = clonedWindow.document.querySelector(selector);
|
||||
return renderWindow(node, container, options, windowWidth, windowHeight);
|
||||
var oncloneHandler = (typeof(options.onclone) === "function") ? Promise.resolve(options.onclone(clonedWindow.document)) : Promise.resolve(true);
|
||||
return oncloneHandler.then(function() {
|
||||
return renderWindow(node, container, options, windowWidth, windowHeight);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user