feat(codeblock): Add wrapping and persistent copy action - #122780
feat(codeblock): Add wrapping and persistent copy action#122780evanpurkhiser wants to merge 1 commit into
Conversation
Story previewsPreview the stories changed in this PR on the Vercel deployment: Preview deployment: https://sentry-3zj3zukpy.sentry.dev |
66a07a9 to
e67bbed
Compare
| ${p => | ||
| p.wrapMode === 'wrap' && | ||
| p.reserveCopyButtonSpace && | ||
| css` | ||
| &::before { | ||
| content: ''; | ||
| float: right; | ||
| width: ${p.theme.space['3xl']}; | ||
| height: ${p.theme.space['3xl']}; | ||
| } | ||
| `} |
There was a problem hiding this comment.
Good catch. The exclusion only applied in wrapping mode, so the persistent copy action could overlap a regular scrolling snippet. Scrolling blocks now reserve trailing space, while wrapping blocks use a 12×16px float exclusion limited to the first line.
— Claude Code
| <CodeBlock alwaysShowCopyButton language="bash"> | ||
| pnpm install @sentry/browser | ||
| </CodeBlock> | ||
| </Storybook.Demo> |
There was a problem hiding this comment.
| </Storybook.Demo> | |
| </Storybook.Demo> | |
| ```tsx | |
| <CodeBlock alwaysShowCopyButton language="bash"> | |
| pnpm install @sentry/browser | |
| </CodeBlock> | |
| ``` |
There was a problem hiding this comment.
Added the JSX example below the demo.
— Claude Code
| Ask your coding agent to configure Sentry and verify that an error reaches your | ||
| project. | ||
| </CodeBlock> | ||
| </Storybook.Demo> |
There was a problem hiding this comment.
| </Storybook.Demo> | |
| </Storybook.Demo> | |
| ```tsx | |
| <CodeBlock alwaysShowCopyButton wrapMode="wrap"> | |
| Ask your coding agent to configure Sentry and verify that an error reaches your project. | |
| </CodeBlock> | |
| ``` |
There was a problem hiding this comment.
Added the JSX example below the wrapping demo.
— Claude Code
e67bbed to
05e3185
Compare
Support prose-like snippets that need to fit constrained layouts while keeping their primary copy action visible.
05e3185 to
cd8e994
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 05e3185. Configure here.
| width: ${p.theme.space.lg}; | ||
| height: ${p.theme.space.xl}; | ||
| } | ||
| `} |
There was a problem hiding this comment.
Copy button overlaps wrapped text
Medium Severity
The wrap-mode spacer for the persistent copy control is smaller than the floating copy button, so wrapped snippet text still runs underneath it. That breaks the reserved-space behavior for alwaysShowCopyButton with wrapMode="wrap".
Reviewed by Cursor Bugbot for commit 05e3185. Configure here.



Summary
Adds reusable CodeBlock options for prose-like snippets in constrained layouts:
Testing
.venv/bin/prek run -q --files static/app/components/core/code/codeBlock.tsx static/app/components/core/code/codeBlock.mdxnode_modules/.bin/knipnode_modules/.bin/knip --production --exclude dependencies