You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The copy logic within the `Expandable` component in
`src/components/expandable/index.tsx` was refined to prevent unwanted
inline code from being copied.
Previously, the copy button selected all `<code>` elements, including
inline code snippets like `.cursorrules` and `rules.md` from explanatory
text.
The changes implement a more selective approach:
* **Primary Selection**: The component now first attempts to copy
content from `pre code` elements, which typically contain main code
blocks.
* **Fallback Filtering**: If no `pre code` blocks are found, a fallback
mechanism filters all `<code>` elements. It excludes:
* Code elements found within paragraphs.
* Short code snippets (less than 100 characters), which are likely
inline.
* **Final Fallback**: If no suitable code blocks are identified, the
entire text content of the expandable section is copied.
This ensures that only the intended code content is copied, omitting
extraneous inline text.
---------
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
0 commit comments