forked from chatboxai/chatbox
-
Notifications
You must be signed in to change notification settings - Fork 155
Open
Description
Current Behavior
Code blocks are rendered through the markdown-it library with syntax highlighting via highlight.js in the Block component. When users want to copy code, they must:
Reproduction Steps:
- Launch the Chatbox application
- Send a message asking for code (e.g., "Write a Python function to calculate fibonacci numbers")
- Wait for the AI response containing a code block
- Observe: There is no dedicated copy button, and users must rely on manual text selection which can be imprecise
Expected Behavior
Each rendered code block should display a copy button that allows users to copy the code content with a single click. The button should provide visual feedback confirming the copy action.
Acceptance Criteria:
- A copy button appears on each code block in assistant messages
- Clicking the copy button copies the code content (without syntax highlighting HTML) to the system clipboard
- A visual indicator (such as a toast notification or button state change) confirms the copy action
- The copy button has appropriate styling that makes it visible but not intrusive
- The copy functionality works for code blocks in all supported languages
Steps To Test
- Start the application and create a new chat session
- Send a message requesting code: "Write a JavaScript function to reverse a string"
- Wait for the AI response with a code block
- Verify a copy button is visible on the code block
- Click the copy button
- Verify you see a confirmation (toast notification or button feedback)
- Paste into a text editor (Ctrl+V or Cmd+V)
- Confirm the code content was copied correctly without HTML markup
Submission
Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.
Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx
Metadata
Metadata
Assignees
Labels
No labels