Repository navigation
v1.1.0
Release Notes: Clipify v1.1.0
Overview
This release introduces major enhancements to the Clipify library, extending its functionality for better clipboard management and usability. These updates include support for handling files, retrieving clipboard items by key, improved expiry management, and more comprehensive event handling.
New Features
1. File Handling
- Added the ability to store files (e.g., images, documents) in clipboard history.
- New Method:
copyFileto add files to the clipboard history.
Example:const fileBlob = new Blob(["File content"], { type: "text/plain" }); clipboard.copyFile(fileBlob, "fileKey", 10000);
2. Retrieve Items by Key
- You can now retrieve specific clipboard items by their associated key.
Example:const item = clipboard.getHistory("noteKey"); console.log(item);
3. Enhanced Expiry Management
- Clipboard items (both text and files) can now have an associated expiry time, after which they are automatically removed.
- Expired items trigger an
expireevent.
4. Improved Event System
- Added
copyandexpireevents for both text and files. - Listen to clipboard actions in real-time:
clipboard.on("copy", (data) => console.log("Copied:", data)); clipboard.on("expire", (data) => console.log("Expired:", data));
Improvements
- History Management:
- Improved the handling of clipboard history to differentiate between text and file items.
- Streamlined methods to access the full clipboard history or specific entries.
- API Simplification:
- Unified the handling of text and files with clearer method names.
- Added optional keys to better identify and retrieve items.
- Documentation:
- Updated JSDoc comments for all methods.
- Enhanced README for easier onboarding.
Bug Fixes
- Fixed incorrect type checks for clipboard items, ensuring compatibility with diverse content types.
- Addressed an issue where expiry timers were not cleared for already-expired items.
- Resolved errors in browsers lacking
navigator.clipboardsupport by providing clear fallback messaging.
Breaking Changes
getHistorynow requires a key to retrieve specific items. The old index-based retrieval has been deprecated.- Migration: Replace
clipboard.getHistory(index)withclipboard.getHistory(key).
- Migration: Replace
Deprecations
- Index-based retrieval for clipboard history is deprecated and will be removed in the next major release. Please migrate to key-based retrieval.
How to Upgrade
- Update your package via NPM or Yarn:
npm update clipify
- Review the new API changes in the documentation.
Feedback
We appreciate your feedback! Please report issues or suggest features via our GitHub Issues.
Thank you for using Clipify! 🎉