Skip to content

@koddsson koddsson released this Aug 15, 2019 · 1 commit to master since this release

<clipboard-copy> element

Copy element text content or input values to the clipboard.

Installation

$ npm install --save @github/clipboard-copy-element

Usage

import '@github/clipboard-copy-element'
<clipboard-copy for="blob-path" class="btn btn-sm BtnGroup-item">
  Copy path
</clipboard-copy>
<div id="blob-path">src/index.js</div>

Data sources

Attribute

<clipboard-copy value="src/index.js">Copy</clipboard-copy>

Element content

<clipboard-copy for="blob-path">Copy</clipboard-copy>
<div id="blob-path">src/index.js</div>

Form input

<clipboard-copy for="blob-path">Copy</clipboard-copy>
<input id="blob-path" value="src/index.js">

Hyperlink href

<clipboard-copy for="blob-path">Copy full URL</clipboard-copy>
<a id="blob-path" href="/path/to#my-blob">Link text will not be copied</a>

Events

After copying to the clipboard, a clipboard-copy event is dispatched from
the <clipboard-copy> element:

document.addEventListener('clipboard-copy', function(event) {
  const button = event.target
  button.classList.add('highlight')
})

Browser support

Browsers without native custom element support require a polyfill.

  • Chrome
  • Firefox
  • Safari
  • Microsoft Edge

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.

Assets 2
  • Merge pull request #18 from github/add-typescript-definition-file f2902b3
  • Merge branch 'master' into add-typescript-definition-file 3fe5fc9
  • set a name for the UMD bundle ece9825
  • default export class in flow definition file 4e47911
  • export ClipboardCopyElement by default da30301
  • reference typescript file in package.json 3847935
  • add typescript definition file 4b345c1

v1.0.4...v1.0.5

Assets 2

@koddsson koddsson released this Aug 9, 2019 · 9 commits to master since this release

<clipboard-copy> element

Copy element text content or input values to the clipboard.

Installation

$ npm install --save @github/clipboard-copy-element

Usage

import '@github/clipboard-copy-element'
<clipboard-copy for="blob-path" class="btn btn-sm BtnGroup-item">
  Copy path
</clipboard-copy>
<div id="blob-path">src/index.js</div>

Data sources

Attribute

<clipboard-copy value="src/index.js">Copy</clipboard-copy>

Element content

<clipboard-copy for="blob-path">Copy</clipboard-copy>
<div id="blob-path">src/index.js</div>

Form input

<clipboard-copy for="blob-path">Copy</clipboard-copy>
<input id="blob-path" value="src/index.js">

Hyperlink href

<clipboard-copy for="blob-path">Copy full URL</clipboard-copy>
<a id="blob-path" href="/path/to#my-blob">Link text will not be copied</a>

Events

After copying to the clipboard, a clipboard-copy event is dispatched from
the <clipboard-copy> element:

document.addEventListener('clipboard-copy', function(event) {
  const button = event.target
  button.classList.add('highlight')
})

Browser support

Browsers without native custom element support require a polyfill.

  • Chrome
  • Firefox
  • Safari
  • Microsoft Edge

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.

Assets 2

@koddsson koddsson released this Aug 9, 2019 · 8 commits to master since this release

  • Merge pull request #20 from github/publish-to-gpr-as-well ed91610
  • publish to GPR as a postpublish step 70ead12

v1.0.3...v1.0.4

Assets 2

@koddsson koddsson released this Jul 30, 2019 · 11 commits to master since this release

  • Merge pull request #19 from github/update-deps a5fb22f
  • run npm audit fix 0cc473a
  • update eslint-plugin-github, flow and karma-chrome-launcher to latest versions f3a5624
  • run npm update e3a96e4

v1.0.2...v1.0.3

Assets 2

@koddsson koddsson released this Jul 22, 2019 · 16 commits to master since this release

  • Merge pull request #17 from github/update-deps 3355875
  • update eslint, eslint-plugin-github and flow-bin manually to latest versions 186dbe6
  • run npm update 28f0ad6
  • update package name in README.md 003b465

v1.0.1...v1.0.2

Assets 2

@koddsson koddsson released this May 23, 2019 · 21 commits to master since this release

Package has been renamed to include the @github scope. You can now find it at https://www.npmjs.com/package/@github/clipboard-copy-element on npm.

v1.0.0...v1.0.1

Assets 2
Apr 22, 2019
1.0.0
Mar 29, 2019
0.7.0
Feb 25, 2019
0.6.0
You can’t perform that action at this time.