remove image resizing for mobile chat download

This commit is contained in:
Jing Hua 2023-03-11 19:28:39 +08:00
parent d00984ba81
commit 94d5ad3692

View file

@ -28,10 +28,13 @@ export const isChats = (chats: any): chats is ChatInterface[] => {
};
export const htmlToImg = async (html: HTMLDivElement) => {
const needResize = window.innerWidth >= 1024;
const initialWidth = html.style.width;
html.style.width = '1023px';
if (needResize) {
html.style.width = '1023px';
}
const canvas = await html2canvas(html);
html.style.width = initialWidth;
if (needResize) html.style.width = initialWidth;
const dataURL = canvas.toDataURL('image/png');
return dataURL;
};