This is an Ember CLI addon for adding a Zero Clipboard component.
$ npm install --save-dev ember-cli-zero-clipboard
In your handlebars template just do:
or
- TEXT: String, to be copied when button is clicked.
- TARGET_ELEMENT_ID: String, value or html contents to be copied.
- LABEL: String, the value of the button.
will output:
<div title="Copy to clipboard" data-clipboard-text="https://github.com/aomra015/ember-cli-zero-clipboard">
<button class="btn btn-default">Copy</button>
</div>
You can subclass this module if you want to add specific behaviours:
// file: your-app/components/zero-clipboard.js
import ZeroClipboard from 'ember-cli-zero-clipboard/components/zero-clipboard';
export default ZeroClipboard.extend({
actions: {
afterCopy: function(){
// this gets triggered after the copy event
// see https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/api/ZeroClipboard.md#static-events for full list of events
alert("after copy");
}
}
});
You can also pass a closure action, without subclassing the component.
Pass a block if you want to customize the html: