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

Co-authored-by: sb <sb@example.com>
fix-screenshots
Sulabh Bista 2022-02-07 13:33:08 -08:00 zatwierdzone przez GitHub
rodzic da4d566bd8
commit bb8cfab474
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -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)