
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.
clipboard-dom
Advanced tools
Makes a DOM element (i.e. <button>) write to the system clipboard
$ component install component/clipboard-dom
var Clip = require('clipboard-dom');
// set the path to the swf file first
Clip.swf('/swf/ZeroClipboard.swf');
// create a "Clip" instance
var ele = document.getElementById('copy-button');
var parent = ele.parentNode; // parent should "have layout"
var clip = new Clip(ele, parent);
// listen for meaningful events
clip.on('load', function(){
console.log('button loaded');
});
clip.on('completed', function(text){
console.log('copied text to the clipboard:', text);
});
clip.on('mousedown', function() {
// "mousedown" is the last chance to set the text before it gets copied
var input = document.getElementById('copy-text');
clip.text(input.value);
});
Fired when the SWF movie for the clipboard instance has loaded.
Fired when the user clicks on the button and the text has been copied. The text that got copied is passed in as an argument.
Fired when the user mouses over the button.
Fired when the user mouses away from the button.
Fired when the user pressed the mouse down on the button.
Fired when the user releases the mouse from the button.
FAQs
Copy-to-Clipboard on a DOM element
We found that clipboard-dom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 25 open source maintainers 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.