@@ -72,7 +72,9 @@ function downloadThread({ as = Format.PNG } = {}) {
7272 const pixelRatio = window . devicePixelRatio ;
7373 const minRatio = as === Format . PDF ? 2 : 2.5 ;
7474 window . devicePixelRatio = Math . max ( pixelRatio , minRatio ) ;
75- html2canvas ( elements . thread ) . then ( async function ( canvas ) {
75+ html2canvas ( elements . thread , {
76+ letterRendering : true ,
77+ } ) . then ( async function ( canvas ) {
7678 elements . restoreLocation ( ) ;
7779 window . devicePixelRatio = pixelRatio ;
7880 const imgData = canvas . toDataURL ( "image/png" ) ;
@@ -144,6 +146,7 @@ class Elements {
144146 this . scroller = Array . from (
145147 document . querySelectorAll ( '[class*="react-scroll-to"]' )
146148 ) . filter ( ( el ) => el . classList . contains ( "h-full" ) ) [ 0 ] ;
149+ this . images = Array . from ( document . querySelectorAll ( "img[srcset]" ) ) ;
147150 }
148151 fixLocation ( ) {
149152 this . threadWrapper . style . overflow = "auto" ;
@@ -155,6 +158,11 @@ class Elements {
155158 this . positionForm . style . display = "none" ;
156159 this . scroller . classList . remove ( "h-full" ) ;
157160 this . scroller . style . minHeight = "100vh" ;
161+ this . images . forEach ( ( img ) => {
162+ const srcset = img . getAttribute ( "srcset" ) ;
163+ img . setAttribute ( "srcset_old" , srcset ) ;
164+ img . setAttribute ( "srcset" , "" ) ;
165+ } ) ;
158166 }
159167 restoreLocation ( ) {
160168 this . threadWrapper . style . overflow = null ;
@@ -166,6 +174,11 @@ class Elements {
166174 this . positionForm . style . display = null ;
167175 this . scroller . classList . add ( "h-full" ) ;
168176 this . scroller . style . minHeight = null ;
177+ this . images . forEach ( ( img ) => {
178+ const srcset = img . getAttribute ( "srcset_old" ) ;
179+ img . setAttribute ( "srcset" , srcset ) ;
180+ img . setAttribute ( "srcset_old" , "" ) ;
181+ } ) ;
169182 }
170183}
171184
@@ -202,7 +215,9 @@ function getData() {
202215 ) ;
203216 const data = {
204217 main : document . querySelector ( "main" ) . outerHTML ,
205- css : `${ globalCss } ${ localCss } ` ,
218+ // css: `${globalCss} /* GLOBAL-LOCAL */ ${localCss}`,
219+ globalCss,
220+ localCss,
206221 } ;
207222 return data ;
208223}
0 commit comments