Skip to content

v1.1.0

Choose a tag to compare

@MindInitiatives MindInitiatives released this 18 Nov 20:59
· 11 commits to main since this release

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: copyFile to 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 expire event.

4. Improved Event System

  • Added copy and expire events 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.clipboard support by providing clear fallback messaging.

Breaking Changes

  • getHistory now requires a key to retrieve specific items. The old index-based retrieval has been deprecated.
    • Migration: Replace clipboard.getHistory(index) with clipboard.getHistory(key).

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

  1. Update your package via NPM or Yarn:
    npm update clipify
  2. 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! 🎉