Skip to content

Releases: github/clipboard-copy-element

v1.3.0

28 Sep 21:01
a043058
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.2.1...v1.3.0

v1.2.1

08 Jun 14:34
7d02e76
Compare
Choose a tag to compare

Fix package exports

Full Changelog: v1.2.0...v1.2.1

v1.2.0

08 Jun 14:20
f70862f
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.1.2...v1.2.0

v1.1.2

20 Jan 16:32
65f860a
Compare
Choose a tag to compare
  • Add type to HTMLElementTagNameMap in typescript declaration file (#28)

v1.1.1...v1.1.2

v1.1.1

06 Nov 18:31
0e2e1d2
Compare
Choose a tag to compare
  • Fix for -> input.id not getting copied in < iOS 13 #27

v1.1.0

05 Nov 16:14
bdb7058
Compare
Choose a tag to compare

Add support for Shadow DOM in #26, with thanks to @jorgecasar.

1.0.7

08 Oct 14:54
v1.0.7
Compare
Choose a tag to compare
  • Fixed Flow module declaration #22

v1.0.6

12 Sep 10:45
Compare
Choose a tag to compare
  • types(ts): add window declaration 98626fd

v1.0.5...v1.0.6

v1.0.5

15 Aug 09:59
072076d
Compare
Choose a tag to compare
  • 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

1.0.5

15 Aug 09:59
f2902b3
Compare
Choose a tag to compare

<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.