export default()

in helpers/copy_to_clipboard.js [2:25]


export default (text) => {
  const textArea = document.createElement('textarea');
  textArea.value = text;
  textArea.style.position = 'fixed';
  textArea.style.top = '0px';
  textArea.style.left = '0px';
  const body = document.querySelector('body');
  body.appendChild(textArea);

  textArea.focus();
  textArea.select();

  let success = false;

  try {
    success = document.execCommand('copy');
  } catch (err) {
    // noop
  }

  body.removeChild(textArea);

  return success;
};