Socket
Book a DemoInstallSign in
Socket

ember-cli-zero-clipboard

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-zero-clipboard

Ember CLI addon for adding a 'copy to clipboard' button component.

1.1.1
latest
Source
npmnpm
Version published
Weekly downloads
20
233.33%
Maintainers
1
Weekly downloads
 
Created
Source

Ember Zero Clipboard

This is an Ember CLI addon for adding a Zero Clipboard component.

Installation

$ npm install --save-dev ember-cli-zero-clipboard

Usage

In your handlebars template just do:

{{zero-clipboard text=TEXT label=LABEL}}

or

{{zero-clipboard cbTarget=TARGET_ELEMENT_ID label=LABEL}}
  • 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.

Example

{{zero-clipboard text=repoPath label="Copy" innerClass="btn btn-default"}}

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>

Extending

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.

{{zero-clipboard afterCopy=(action "alertAfterCopy")}}

Pass a block if you want to customize the html:

{{#zero-clipboard text='Hello'}}
  <p>COPY ME!</p>
{{/zero-clipboard}}

Keywords

ember-addon

FAQs

Package last updated on 12 Sep 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.