feat(preview): add inline code copy action - #1359
Conversation
|
@happykawayigt Thanks, have you checked the UI. A short manual test? |
|
Could you rebase. |
37eb95c to
3c5e37d
Compare
|
I checked, the design it looks different to the codeblock, the tooltip, ... |
4355bba to
2a49d11
Compare
|
Fixed in 2a49d11. I aligned the inline control with the fenced-code control by reusing TooltipWrapper and the same border, background, foreground, and hover styling while keeping the compact inline size. Manual UI check: I rendered inline and fenced code together through the real MarkdownPreview, verified the inline control appears on hover, the tooltip says “Copy code”, and clicking changes the accessible label to “Code copied”. The targeted preview tests (8), lint, and build all pass. |
|
Hi @happykawayigt, Thanks again! It looks already pretty good, but I think it is better, when no padding is on the right side.
As the copy button is only visible on hover I think it is ok to overlap the content with the button. |
2a49d11 to
773769b
Compare
Use --radius-sm instead of an off-scale 0.125rem (no existing token is that small) and add the opacity transition the app's other hover-reveal control (headline anchors) already uses, so the button doesn't pop in/out.
|
Ran the copy button through a design-consistency check against the app's existing patterns (fenced-code copy button, headline-anchor hover-reveal) and pushed a small follow-up commit (
Left the icon-overlapping-text-on-hover behavior as-is (not adding extra margin/padding for it). Everything else — clipboard/toast reuse, color tokens, icons — already matched house conventions well. (Also ran into a pre-existing, unrelated bug while testing — inline code spans rendering with literal backticks — confirmed it reproduces on main too, so it's not from this PR. Logged separately, not something to fix here.) |

Summary
Validation
npm run buildnpm run lintgit diff --checknpm test -- --run: 284 passed, 1 failed inHotKeyHandler.test.tsx; the same full-suite-only failure reproduces on a clean latestmain(280 passed, 1 failed), while that test passes in isolationFixes #1358
AI assistance: Codex was used to help investigate, implement, and test this change.