((Drupal, once) => {
  Drupal.behaviors.clickCopy = {
    attach(context) {
      let copyButton = once("clickCopy", "#copy-button");
      copyButton.forEach((btn) => {
        btn.addEventListener("click", function (e) {
          let content = document.querySelector(".snippet-content pre code");
          navigator.clipboard.writeText(content.textContent);

          // Make some type of vidual indivator that text was copied
          btn.textContent = 'check';
          setTimeout(function() {
            btn.textContent = 'content_copy';
          }, 500);
        });
      });
    },
  };
})(Drupal, once);
