Skip to content

Conversation

@abhichaurasiya2022
Copy link

@abhichaurasiya2022 abhichaurasiya2022 commented Oct 26, 2025

Description

This PR updates the useCopyToClipboard hook to support copying multiple clipboard formats (plain text, HTML, and Markdown) using the modern ClipboardItem API.

Resolves

Resolves #329

Changes

Core Implementation

  • Enhanced useCopyToClipboard to accept either a string or an object with multiple format properties (plain, html, markdown)
  • Implemented ClipboardItem API support for copying multiple formats simultaneously
  • Maintained backward compatibility - existing usage with plain strings continues to work
  • Added proper fallback handling for browsers that don't support ClipboardItem

Type Definitions

  • Added new ClipboardFormats type to index.d.ts with optional properties for different formats
  • Updated function signature to accept string | ClipboardFormats

Benefits

  • Enables copying rich content (HTML formatting, Markdown) to clipboard
  • Applications can provide formatted content that preserves styling when pasted
  • No breaking changes - fully backward compatible
  • Better user experience with multiple paste format options

@abhichaurasiya2022 abhichaurasiya2022 changed the title fixes #329: Add multi-format clipboard support to useCopyToClipboard #356 fixes #329: Add multi-format clipboard support to useCopyToClipboard Oct 26, 2025
@kdawgwilk
Copy link

I feel like i am missing something or this is a spam PR? This PR has nothing to do with the useCopyToClipboard hook

@abhichaurasiya2022 abhichaurasiya2022 force-pushed the abhishek/useCopyToClipboard--fix branch 2 times, most recently from 5ceea89 to e4afabf Compare October 27, 2025 00:19
@abhichaurasiya2022
Copy link
Author

abhichaurasiya2022 commented Oct 27, 2025

I feel like i am missing something or this is a spam PR? This PR has nothing to do with the useCopyToClipboard hook

Oho! By mistake wrong commit pushed to this branch, updated. @kdawgwilk

@abhichaurasiya2022 abhichaurasiya2022 force-pushed the abhishek/useCopyToClipboard--fix branch from e4afabf to d7b46b4 Compare October 27, 2025 00:27
@abhichaurasiya2022 abhichaurasiya2022 changed the title fixes #329: Add multi-format clipboard support to useCopyToClipboard feat: Add multi-format clipboard support to useCopyToClipboard Oct 27, 2025
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.

Update useCopyToClipboard to handle multiple formats

2 participants