-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix copy button output on logging page #13972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix copy button output on logging page #13972
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request refines the copy logic of the Expandable component on the logging page to ensure that only the intended code content—mainly from code blocks—is copied.
- Prioritizes copying text from "pre code" elements for main code blocks.
- Introduces a fallback filtering mechanism that excludes inline code snippets based on proximity to paragraph elements and a 100-character threshold.
- Provides a final fallback to copy the entire content if no suitable code blocks are found.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Bundle ReportChanges will increase total bundle size by 238 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: sentry-docs-server-cjsAssets Changed:
Files in
App Routes Affected:
view changes for bundle: sentry-docs-client-array-pushAssets Changed:
Files in
|
|
Didn't see this and had a fix here too #13973 |
The copy logic within the
Expandablecomponent insrc/components/expandable/index.tsxwas refined to prevent unwanted inline code from being copied.Previously, the copy button selected all
<code>elements, including inline code snippets like.cursorrulesandrules.mdfrom explanatory text.The changes implement a more selective approach:
pre codeelements, which typically contain main code blocks.pre codeblocks are found, a fallback mechanism filters all<code>elements. It excludes:This ensures that only the intended code content is copied, omitting extraneous inline text.