File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -70,9 +70,25 @@ function downloadThread({ as = Format.PNG } = {}) {
7070 const pixelRatio = window . devicePixelRatio ;
7171 const minRatio = as === Format . PDF ? 2 : 2.5 ;
7272 window . devicePixelRatio = Math . max ( pixelRatio , minRatio ) ;
73- html2canvas ( elements . thread , {
74- letterRendering : true ,
75- } ) . then ( async function ( canvas ) {
73+ html2canvas ( elements . thread ,
74+ {
75+ letterRendering : true ,
76+ onclone : function ( cloneDoc ) {
77+ //Make small fix of position to all the text containers
78+ let listOfTexts = cloneDoc . getElementsByClassName ( 'min-h-[20px]' ) ;
79+ Array . from ( listOfTexts ) . forEach ( ( text ) => {
80+ text . style . position = 'relative' ;
81+ text . style . top = '-8px' ;
82+ } ) ;
83+
84+ //Delete copy button from code blocks
85+ let listOfCopyBtns = cloneDoc . querySelectorAll ( 'button.flex' ) ;
86+ Array . from ( listOfCopyBtns ) . forEach (
87+ ( btn ) => ( btn . remove ( ) )
88+ ) ;
89+ }
90+ }
91+ ) . then ( async function ( canvas ) {
7692 elements . restoreLocation ( ) ;
7793 window . devicePixelRatio = pixelRatio ;
7894 const imgData = canvas . toDataURL ( "image/png" ) ;
You can’t perform that action at this time.
0 commit comments