From b71a88fc591015054c05c49308bd78d4fa13b06d Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin Date: Fri, 29 Sep 2023 14:45:41 +0800 Subject: [PATCH] dev(pkg::core): add a page class for css selector --- packages/typst.ts/examples/typst.ts.css | 4 ++++ packages/typst.ts/src/render/canvas/view.mts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/packages/typst.ts/examples/typst.ts.css b/packages/typst.ts/examples/typst.ts.css index d450e899..87cdebe0 100644 --- a/packages/typst.ts/examples/typst.ts.css +++ b/packages/typst.ts/examples/typst.ts.css @@ -8,6 +8,10 @@ body { margin: 0; } +.typst-page.canvas { + margin: 0; +} + .text-layer { position: relative; left: 0; diff --git a/packages/typst.ts/src/render/canvas/view.mts b/packages/typst.ts/src/render/canvas/view.mts index a1a91001..a48afbb9 100644 --- a/packages/typst.ts/src/render/canvas/view.mts +++ b/packages/typst.ts/src/render/canvas/view.mts @@ -71,6 +71,8 @@ export class RenderView { annotationLayer.style.width = `${containerWidth}px`; annotationLayer.style.height = `${height * orignalScale}px`; annotationLayer.style.position = 'absolute'; + commonDiv.classList.add('typst-page'); + commonDiv.classList.add('canvas'); commonDiv.style.width = `${containerWidth}px`; commonDiv.style.height = `${height * orignalScale}px`; commonDiv.style.position = 'relative';