From 13d3062f37264a36259b0c0fd938b7fb8af8ce42 Mon Sep 17 00:00:00 2001 From: onmax Date: Tue, 17 Nov 2026 21:41:48 +0100 Subject: [PATCH] fix(docs): pad the playground preview 1rem instead of 2rem --- docs/preview.ts | 5 +++-- e2e/play-preview.e2e.ts | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/preview.ts b/docs/preview.ts index dcc3487c..b64fa9bd 100644 --- a/docs/preview.ts +++ b/docs/preview.ts @@ -4,10 +4,11 @@ import { readTheme, schemeCss, schemeOf, themeCss } from "./play-theme.ts"; // The playground's preview is a document of its own, so the plugins' inlined scripts run as they do on a real page. // The build writes the first preset with it and the playground every edit after, with the Theme pane's scheme as a -// class on the root and its CSS in #play-theme, so a render doesn't flash the default theme. +// class on the root and its CSS in #play-theme, so a render doesn't flash the default theme. The body keeps 1rem, so +// annotate's marks and badges, which sit past a screenshot's edge, aren't cut off by the frame. export const previewDocument = (html: string, theme?: { scheme: string; css: string }) => `` + - `` + + `` + `` + `
${html}
`; diff --git a/e2e/play-preview.e2e.ts b/e2e/play-preview.e2e.ts index f7444a97..82261f0e 100644 --- a/e2e/play-preview.e2e.ts +++ b/e2e/play-preview.e2e.ts @@ -109,3 +109,10 @@ test("system changes preserve custom theme colors", async ({ page }) => { await setSystem(page, "dark"); await expect(text).toHaveCSS("background-color", "rgb(46, 16, 101)"); }); + +test("the preview pads its content only enough for marks drawn past a block's edge", async ({ + page, +}) => { + await open(page, "light"); + await expect(preview(page).locator("body")).toHaveCSS("padding", "16px"); +});