-
Notifications
You must be signed in to change notification settings - Fork 45
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
Include message card in Image Export so dark mode text is visible #652
base: main
Are you sure you want to change the base?
Conversation
…d (as messageCard) instead of card body content (as messageContent)
Deploying chatcraft-org with Cloudflare Pages
|
src/lib/utils.ts
Outdated
windowWidth: element.scrollWidth, | ||
windowHeight: element.scrollHeight, | ||
}); | ||
return html2canvas(element, {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the options object is empty ({}
) we can remove it from our code.
I'm wondering if we should replace it with a Partial object so maintainers know we can configure options for it, something like this (I'm not 100% on the TypeScript usage):
import { Options } from "html2canvas";
// ...
export const screenshotElement = (element: HTMLElement): Promise<Blob> => {
return import("html2canvas")
.then((module) => {
const options: Partial<Options> = {};
const html2canvas = module.default;
return html2canvas(element, options);
})
.then(
// ...
);
};
I tested this and I found the same problem you described on Firefox and Safari (surprisingly not on Chrome after many attempts). I think adding a delay is a good idea. |
This fixes #651
The white text in the dark mode card body is camouflaged by the white background of html2canvas.
One solution to make this text visible is to include the entire card (which wraps the text) in the HTML sent to html2canvas:
Before (card body only, white text invisible):
After (entire card, white text appears as rendered inside card: