[feature] Transparent or white background on export (#565)

Co-authored-by: sb <sb@example.com>
This commit is contained in:
Sulabh Bista 2022-02-07 13:33:08 -08:00 committed by GitHub
parent da4d566bd8
commit bb8cfab474
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,6 +74,10 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
app.selectAll()
app.zoomToSelection()
app.selectNone()
const tlContainer = document.getElementsByClassName('tl-container').item(0) as HTMLElement;
if (tlContainer) {
tlContainer.style.background = 'transparent';
}
} catch (e) {
err = e.message
}
@ -83,6 +87,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
const imageBuffer = await page.screenshot({
type,
omitBackground: true
})
await browser.close()
res.status(200).send(imageBuffer)