-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
appear a bug called: 'Uncaught (in promise) ' #175
Comments
Even Im getting same error for particular DIV..In other places it is working fine |
For me this is occurring when trying to select the body. I'd like to image the entire page, so using |
So I've managed to get it to work on the import domToImage from "dom-to-image";
function filterNode(node) {
if (node instanceof Text) {
return true;
}
return [
"div",
"span",
"p",
"i",
"strong",
"main",
"aside",
"article",
"pre",
"code",
"time",
"address",
"header",
"footer"
].includes(node.tagName.toLowerCase()) || /^h[123456]$/i.test(node.tagName);
}
export function getBodyImage(body = document.body) {
// @todo: Get data from S3 if it exists
return domToImage
.toJpeg(body, { quality: 70, filter: filterNode, bgcolor: "#fff", imagePlaceholder: "https://placem.at/places?w=500" });
} UPDATE: Adding |
Thanks @perry-mitchell, My issue fixed with your solution. |
Use case: description, code
Expected behavior
i want the bug never happen again, because when it happen, my code will regard it as a failure so the loading status will never end which make my users can not use the other picture.just like this:
Actual behavior (stack traces, console logs etc)
the atcual behavior just like i say above. and the stack traces like this:(i think the bug may not be caused by dom-to-image, but i do not how to fix, beacuse it only happen sometimes)
Library version
Browsers
The text was updated successfully, but these errors were encountered: