pi-mono/apps/p2/plugins/artifacts/artifacts.css
Mario Zechner 3c1e7798bd fix(p2): a Markdown artifact beside the transcript keeps the reader's place across versions
Each new version of an open md artifact blanked the pane (a spinner while the version was
read) and drew the document again from its start: a reader of a long document the agent
edits every minute was thrown back to the top each time.

The pane now keeps showing the version it has until the new one is read, and keeps the
reader's place: the block at the top of the pane (by tag and text), or else the heading
above it, stays where it was after the new version renders, so text inserted above does
not move what is being read. Browser scroll anchoring is off for the pane (Safari has none;
it would correct the same change twice). Browser test: ui-artifact-reading.test.ts.
2026-11-23 21:18:29 +01:00

45 lines
1 KiB
CSS

/* Artifacts: the side panel's rows and the item a reader opens there, and artifacts shown in the transcript. */
.artifact-item {
display: flex;
align-items: center;
gap: var(--s2);
}
.artifact-item > .artifact-row {
flex: 1;
min-width: 0;
}
.artifact-kind + .artifact-kind {
margin-top: var(--s3);
}
.artifact-local {
display: flex;
flex-direction: column;
gap: var(--s2);
height: 100%;
min-height: 60vh;
}
.artifact-local > .views-frame,
.artifact-local > .views-doc {
flex: 1;
min-height: 0;
overflow: auto;
}
.artifact-inline {
margin: var(--s2) 0;
}
.artifact-frame.inline {
display: block;
width: 100%;
border: 0;
border-radius: var(--radius, 6px);
background: white;
}
.artifact-md.inline {
padding: 0;
overflow: visible;
}
/* A document beside the transcript keeps the reader's place across versions itself (panes.tsx, `useReadingPlace`), as
browsers without scroll anchoring (Safari) need: the browser's own anchoring would correct the same change twice. */
.artifact-md:not(.inline) {
overflow-anchor: none;
}