Skip to content

Add copy HTML newsletter to clipboard button#188

Merged
simonw merged 1 commit intomainfrom
claude/add-copy-newsletter-button-pmO7x
Dec 27, 2025
Merged

Add copy HTML newsletter to clipboard button#188
simonw merged 1 commit intomainfrom
claude/add-copy-newsletter-button-pmO7x

Conversation

@simonw
Copy link
Owner

@simonw simonw commented Dec 27, 2025

Modify blog-to-newsletter and add a “Copy HTML newsletter to clipboard” button

Adds a new button next to the existing rich text copy button that copies
the raw HTML source of the newsletter to the clipboard, useful for pasting
into email HTML editors or other tools that need the markup directly.

Adds a new button next to the existing rich text copy button that copies
the raw HTML source of the newsletter to the clipboard, useful for pasting
into email HTML editors or other tools that need the markup directly.
@claude
Copy link
Contributor

claude bot commented Dec 27, 2025

Claude finished @simonw's task —— View job


Code Review Complete ✅

  • Read repository guidelines (CLAUDE.md)
  • Analyze the modified file
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Assess performance considerations
  • Evaluate security concerns
  • Review test coverage needs
  • Provide comprehensive feedback

Code Review Feedback

This PR adds a clean and straightforward "Copy HTML newsletter to clipboard" button. The implementation is solid overall with a few observations:

Code Quality & Best Practices

  • Clean, consistent code style that matches existing patterns
  • Proper event handling with async/await
  • Good error handling with try/catch and user feedback
  • Follows existing naming conventions (copyHtml ID, consistent with copyRichText)

Functionality

  • Uses modern navigator.clipboard.writeText() API for better clipboard handling
  • Consistent status messaging pattern with existing code
  • Proper async implementation

⚠️ Potential Considerations

Browser Compatibility: The code uses navigator.clipboard.writeText() which requires HTTPS and has limited support in older browsers. However, this is likely acceptable given:

  • The existing copyRichText function already uses the older document.execCommand('copy') method
  • Modern browsers support navigator.clipboard
  • The try/catch provides graceful error handling

Minor Enhancement Opportunity: Consider adding a fallback to the document.execCommand('copy') approach used in copyRichText() if navigator.clipboard fails, for maximum compatibility.

Security

  • No security concerns identified
  • Uses safe clipboard API methods
  • No XSS vulnerabilities introduced

Performance

  • Minimal performance impact
  • Efficient direct text copying without DOM manipulation

Test Coverage

  • No existing test framework apparent in the codebase
  • This is a simple UI feature that would benefit from manual testing across browsers

Overall Assessment

This is a well-implemented, useful feature that provides the raw HTML export functionality described in the PR. The code is clean, follows existing patterns, and handles errors appropriately. The implementation is production-ready.

@simonw simonw merged commit db7b502 into main Dec 27, 2025
2 of 4 checks passed
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.

2 participants