NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #2663 most downloaded on npm
Copy stuff into clipboard using JS with fallbacks
Last release 5 months ago
24 Apr 2026
Ships unpredictably
gaps range from 3 weeks to 3.4 years
Nearly every release is documented
notes for 27 of 29 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
29 releases · first in 2015
Make sure execCommand works in fullscreen
One column per quarter.
copy() is now async — returns Promise instead of boolean. All call sites must be updated to await copy(...) or .then(...).
copy() is now async — returns Promise<boolean> instead of boolean. All call sites must be updated to await copy(...) or .then(...).window.clipboardData and all IE-specific code paths removed.window.prompt() fallback is now opt-in — pass options.fallbackToPrompt: true to restore. Off by default.dist/ — direct require('copy-to-clipboard/index.js') imports will break; use the package name only.navigator.clipboard.writeText() is now the default copy path in secure contexts (HTTPS / localhost).navigator.clipboard.write() with ClipboardItem for rich text / HTML copying when options.format or options.onCopy is set.options.format — set a custom MIME type (e.g. 'text/html') to copy formatted content; text/plain is always included alongside it.options.onCopy — callback receives a ClipboardItem on the async path (return a replacement to override) or a DataTransfer on the execCommand fallback path.options.fallbackToPrompt — opt-in window.prompt() fallback for non-secure contexts.tsup: dist/index.mjs, dist/index.cjs, dist/index.global.js (IIFE), with a proper exports field and sideEffects: false.index.d.mts) and CJS (index.d.ts) consumers.navigator.userAgentData?.platform with a userAgent regex fallback (fixes #123).console.warn emitted in debug mode when falling back from a non-secure context.Bump minimatch from 3.0.4 to 3.1.2 to address a known security vulnerability.
minimatch from 3.0.4 to 3.1.2 to address a known security vulnerability.#116 fix npm audit #119 add aria hidden attribute
aria-hidden to the hidden copy span to prevent screen readers from narrating the copied text (#119).Fix d.ts issue #96 by @zombieJ
Fix d.ts issue #96 by @zombieJ
add support for onCopy listener for additional modifications of style. by @eitanp461 #89
options.onCopy callback, allowing callers to set custom clipboard formats via the DataTransfer object (#89, merged as #94).#93 fix issue with setting any format via options.format in IE11. Thanks to @wdlb
#79 ability to force specific type for data transfer contributed by @sloanesturz (and special thanks to @julienw for kicking this off)
options.format to copy content with a custom MIME type (#79).update example.js (bundled via uglifyjs)
document.body, avoiding unintended side effects in host applications.Now "toggle-selection": "^1.0.6" (instead of ^1.0.3
Now "toggle-selection": "^1.0.6" (instead of ^1.0.3
toggle-selection minimum version (fixes #67).make examples page available on the web
boolean return type to TypeScript definitions (#52).LICENSE file (#55).https://github.com/sudodoki/copy-to-clipboard/pull/50 by https://github.com/DenisCarriere
https://github.com/sudodoki/copy-to-clipboard/pull/50 by https://github.com/DenisCarriere
#45 by @shvaikalesh #48 by @pugnascotia
#45 by @shvaikalesh #48 by @pugnascotia
cssText to avoid conflicts with host page CSS resets (#48).Reset user-agent styles on the hidden selection element to prevent layout side effects (#44).
https://github.com/sudodoki/copy-to-clipboard/pull/40 by @nkbt fixing server-side rendering
Fixes:
Enhancement:
Docs:
true if the modern clipboard method succeeded, false if the window.prompt() fallback was used (#41).document at import time (#40).Added e2e testing running on saucelabs, which worked for, like, 2 weeks (not long enough to see this release). There're issues with chrome-driver not
Added e2e testing running on saucelabs, which worked for, like, 2 weeks (not long enough to see this release). There're issues with chrome-driver not supporting keyboard events on mac There's issue with pasting multiline text with tags in different browsers having extra newline in some browsers. Would appreciate help fixing this up. There's need to include geckodriver now to run test in default FF browser + figure out whether we can use applescript similar to following snippet
const applescript = require('applescript');
const script = 'tell application "Chrome"\n' +
'activate\n' +
'tell application "System Events"\n' +
'keystroke "v" using {command down}\n' +
'end tell\n' +
'end tell';
on Saucelabs
user-select: none styles - it doesn't inherit it. Thanks to @shvaikaleshmessage option passed to copy would have #{key} interpolated corresponding platform key (⌘+C for macOS/iOS, Ctrl+C otherwise). Thanks to @shvaikalesh yet again for this one.setAttribute instead of the deprecated setter; stop inheriting user-select on the hidden element (#37).Hotfixing issue with Chrome not working via https://github.com/sudodoki/copy-to-clipboard/commit/7e108987ccf46b922709f93de689463fce2a0c45 supposedly
Hotfixing issue with Chrome not working via https://github.com/sudodoki/copy-to-clipboard/commit/7e108987ccf46b922709f93de689463fce2a0c45 supposedly
clip instead of overflow: hidden / zero dimensions to hide the copy element, preventing layout reflow.Fix MS Edge scrolling to appended mark. https://github.com/sudodoki/copy-to-clipboard/pull/27 by @jaybekster
HTMLElement (#27).Remove options.cb callback (introduced in v2.1.0). Use the returned boolean to determine success instead (#25).
Added options.cb: callback to be executed after copy #22.
options.cb callback executed after a successful copy (#22).Added options: debug (console.error is surpassed by default) and promprt (to specify string in prompt - default is 'Copy to clipboard: Ctrl+C, Enter')
debug (console.error is surpassed by default) and promprt (to specify string in prompt - default is 'Copy to clipboard: Ctrl+C, Enter'). Contribution by @evenchange4textContent to work around issues with trying to copy content that needed escaping, but preserving newline to be able to copy multiline text. Idea by @shvaikaleshoptions object as the second argument instead of individual parameters.options.debug and options.message for custom prompt text (#18).textContent instead of innerHTML when seeding the copy element.Add repository field to package.json (#9).
Fix newline handling: switch from textContent to innerHTML when seeding the copy element (fixes #7, #8).
Integrate toggle-selection for reliable selection/deselection across browsers (#5).
IE8 support: guard Selection.removeRange and fix throw usage (#1).
Selection.removeRange and fix throw usage (#1).Nothing published for this version
Initial release. ### ❤️ Contributors - Джон, просто Джон (@sudodoki)
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →