From 94d5ad3692a56989a9b34f42a97ab69fe506efb3 Mon Sep 17 00:00:00 2001 From: Jing Hua Date: Sat, 11 Mar 2023 19:28:39 +0800 Subject: [PATCH] remove image resizing for mobile chat download --- src/utils/chat.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/chat.ts b/src/utils/chat.ts index 9bf3b0f..29dd079 100644 --- a/src/utils/chat.ts +++ b/src/utils/chat.ts @@ -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; };