Sha256: 14e70508b56665aae9c4c56604b95d27b0f5b50faa73731d0edc78e86639ec57

Contents?: true

Size: 363 Bytes

Versions: 3

Compression:

Stored size: 363 Bytes

Contents

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pages_core-3.12.4 app/javascript/lib/copyToClipboard.ts
pages_core-3.12.3 app/javascript/lib/copyToClipboard.ts
pages_core-3.12.2 app/javascript/lib/copyToClipboard.ts