File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,10 +59,12 @@ export const createCustomContentSVG = async (ctx: CanvasRenderingContext2D, opti
5959 document . body . appendChild ( bodyElement )
6060 // convert all images to base64
6161 await convertImgToBase64 ( bodyElement )
62- const { offsetHeight, offsetWidth } = < HTMLElement > bodyElement . querySelector ( '.rich-text-content' )
62+ const rect = bodyElement . querySelector ( '.rich-text-content' ) ?. getBoundingClientRect ( )
63+ const rectWidth = rect ?. width
64+ const rectHeight = rect ?. height
6365 document . body . removeChild ( bodyElement )
64- const width = options . richTextWidth || offsetWidth || options . width
65- const height = options . richTextHeight || offsetHeight || options . height
66+ const width = options . richTextWidth || rectWidth || options . width
67+ const height = options . richTextHeight || rectHeight || options . height
6668 svgElement . setAttribute ( 'width' , width . toString ( ) )
6769 svgElement . setAttribute ( 'height' , height . toString ( ) )
6870 const foreignObjectElement = createSVGElement ( 'foreignObject' , {
You can’t perform that action at this time.
0 commit comments