[root-wrapper] feat(ui): Add copy-to-clipboard button on hover for inline code snippets in blog posts#7791
Conversation
Signed-off-by: Akshat Singhai <akshatsinghai6682@gmail.com>
|
🚀 Preview deployment: https://layer5.io/pr-preview/pr-7791/
|
KatalKavya96
left a comment
There was a problem hiding this comment.
@akshatsinghai6682-sketch Thanks for working on this.
I noticed two things while reviewing/testing this:
-
The emoji icons for copy/success should be replaced with the projects existing icon component or a proper SVG icon so the UI remains consistent across browsers and themes.
-
The current copy logic uses
childrendirectly, but it does not seem to copy all inline code text reliably in some cases. A better approach would be to attach arefto the rendered<code>element and copycodeRef.current.textContent, so the copied value matches the actual visible inline code.
Could you please update the implementation accordingly and also confirm that inline code copying works across blog/docs MDX pages without affecting existing code block rendering?
|
Sure @KatalKavya96 thanks for the feedback |
|
@akshatsinghai6682-sketch Thank you for your contribution! Let's discuss this during the website call tomorrow at 5:30 PM IST | 7 AM CST Add it as an agenda item to the meeting minutes, if you would 🙂 |
|
Sure @Bhumikagarggg i have added it is an agenda item please verify and can u plz clarify what is this meeting about and where can I get the access to its links |
Signed-off-by: Akshat Singhai <akshatsinghai6682@gmail.com>
|
@KatalKavya96 Thank you for the feedback! I have addressed both the review comments:
Screen.Recording.2026-06-14.at.4.40.48.PM.movPlease take a look! |
Description
This PR fixes #7790
Added a copy-to-clipboard button that appears on hover for inline code snippets in blog posts.
Changes
InlineCodecomponent inroot-wrapper.jsnavigator.clipboard.writeText()APIScreenshots/Demo
Screen.Recording.2026-06-14.at.4.40.48.PM.mov
Notes for Reviewers
The InlineCode component is added to the MDXProvider components in root-wrapper.js. It wraps the existing
<code>tag without modifying its styles, so all existing styling is preserved.Signed commits