Sha256: 5cd86ed1507455369940f9004bfbdc189325b38081a15bb6cdb6d1d770500870

Contents?: true

Size: 355 Bytes

Versions: 15

Compression:

Stored size: 355 Bytes

Contents

export function copySupported () {
  return document.queryCommandSupported &&
    document.queryCommandSupported("copy");
}

export default function copyToClipboard (str) {
  const el = document.createElement("textarea");
  el.value = str;
  document.body.appendChild(el);
  el.select();
  document.execCommand("copy");
  document.body.removeChild(el);
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pages_core-3.12.1 app/javascript/lib/copyToClipboard.js
pages_core-3.12.0 app/javascript/lib/copyToClipboard.js
pages_core-3.11.3 app/javascript/lib/copyToClipboard.js
pages_core-3.11.2 app/javascript/lib/copyToClipboard.js
pages_core-3.11.1 app/javascript/lib/copyToClipboard.js
pages_core-3.11.0 app/javascript/lib/copyToClipboard.js
pages_core-3.10.2 app/javascript/lib/copyToClipboard.js
pages_core-3.10.1 app/javascript/lib/copyToClipboard.js
pages_core-3.9.2 app/javascript/lib/copyToClipboard.js
pages_core-3.9.1 app/javascript/lib/copyToClipboard.js
pages_core-3.9.0 app/javascript/lib/copyToClipboard.js
pages_core-3.8.3 app/javascript/lib/copyToClipboard.js
pages_core-3.8.2 app/javascript/lib/copyToClipboard.js
pages_core-3.8.1 app/javascript/lib/copyToClipboard.js
pages_core-3.8.0 app/javascript/lib/copyToClipboard.js