fix: canvas duplication (#26)

This commit is contained in:
D. Kauê
2023-09-15 07:07:38 -03:00
committed by GitHub
parent 66617318d8
commit 5349746971

View File

@ -31,7 +31,7 @@ export default class TypstRenderElement extends HTMLElement {
// this.style.height = TypstRenderElement.prevHeight;
// }
if (this.format == "image") {
if (this.format == "image" && this.canvas == undefined) {
this.canvas = this.appendChild(createEl("canvas", { attr: { height: TypstRenderElement.prevHeight }, cls: "typst-doc" }))
}
@ -131,4 +131,4 @@ export default class TypstRenderElement extends HTMLElement {
ctx.imageSmoothingQuality = "high"
ctx.putImageData(image, 0, 0);
}
}
}