
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@extend-chrome/clipboard
Advanced tools
Using the clipboard in a Chrome Extension can be a pain. The async Clipboard API doesn't work in background scripts and workarounds require lots of boilerplate. This library works in all MV2 Chrome extension contexts. It emulates the Clipboard API readText
and writeText
methods using document.execCommand
.
You will need to use a bundler like Rollup or Webpack to include this library in the build of Chrome extension.
See rollup-plugin-chrome-extension
for an easy way use Rollup to build your Chrome extension!
$ npm i @extend-chrome/clipboard
Add the permissions "clipboardRead"
and/or "clipboardWrite"
to your manifest.json
. Remember, only request the permissions you need! For example, if your extension only reads the clipboard, only request "clipboardRead"
.
{
"permissions": ["clipboardRead", "clipboardWrite"]
}
TypeScript definitions are included, so no need to install an additional @types
library!
import { clipboard } from '@extend-chrome/clipboard'
// Read text from the clipboard, or "paste"
clipboard.readText().then((text) => {
console.log('clipboard contents', text)
})
// Write text to the clipboard, or "copy"
clipboard.writeText('write this to the clipboard').then((text) => {
console.log(text, 'was written to the clipboard')
})
FAQs
Use the clipboard with ease in Chrome extensions.
The npm package @extend-chrome/clipboard receives a total of 170 weekly downloads. As such, @extend-chrome/clipboard popularity was classified as not popular.
We found that @extend-chrome/clipboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.