Add screenshot collecting server

This commit is contained in:
Niklas von Hertzen
2017-08-28 21:27:39 +08:00
parent 5dbb197a82
commit b75fd70042
9 changed files with 180 additions and 26 deletions

View File

@@ -75,8 +75,15 @@ const testSVG = document => {
const testForeignObject = document => {
const img = new Image();
const canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = 1;
const ctx = canvas.getContext('2d');
img.src = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><foreignObject><div></div></foreignObject></svg>`;
ctx.fillStyle = 'red';
ctx.fillRect(0, 0, 1, 1);
img.src = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><foreignObject><img src="${encodeURIComponent(
canvas.toDataURL()
)}" /></foreignObject></svg>`;
return new Promise(resolve => {
const onload = () => {