DOM screenshot by dom-to-image forked & modified from dom-to-image
# YARN
yarn add @mkhuda/dom-screenshot
# NPM
npm install @mkhuda/dom-screenshot
- Change to rollup build
- Add encodeURIComponent on makeSvgDataUri. Based on this issue
- Add Typescript support, (.d.ts) battery included.
- Full rewrite to Typescript
- Adding
chai
test (on progress).
import DomScreenshot from "@mkhuda/dom-screenshot";
....
return(
<button
onClick={() => {
const getElement = document.getElementById("root") as HTMLElement;
const image = DomScreenshot.toPng(document.body, {});
image.then((generatedImage) => {
window.open(generatedImage);
});
}}
>
Test
</button>
)
...
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.