Skip to content

Conversation

@Mairs2
Copy link
Owner

@Mairs2 Mairs2 commented Oct 20, 2025

Add a copy for code blocks for easy code copy.

Add a copy button feature in Block.tsx to add copy buttons for all code blocks in the message only. If the button already exists, it is skipped. Click handler is added, copying only the code element text.

Auto-hide for toast notification is handled in App.tsx by adding a auto-hide duration of 2 sec to the snackbar.

Styling for copy button is done in index.scss for both light and dark theme as well as copy button hover function.

Screenshot 2025-10-19 230020 Screenshot 2025-10-19 230029

https://youtu.be/mP4XPjgf4yM

Fixes #2

Mairs2 added 2 commits October 5, 2025 16:58
Add defense-in-depth validation to ensure user input contains non-whitespace message
  Adds a hover-activated copy button to code blocks that copies code to clipboard and shows a toast notification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue #2 - [FEATURE] Add copy button for code blocks

2 participants