Skip to content

Commit

Permalink
fix copy code block content function
Browse files Browse the repository at this point in the history
  • Loading branch information
dmartinez24 committed Jul 11, 2024
1 parent 390ba11 commit c923764
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
public/
bin/
.idea/
3 changes: 2 additions & 1 deletion internal/assets/doco.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ let doco = {
document.querySelectorAll("pre").forEach((el) => {
let bt = document.createElement("button");
bt.classList.add("material-symbols-outlined", "absolute", "top-3", "right-2", "p-1.5", "bg-gray-50", "hover:bg-gray-100", "rounded");
const elementTextContent = el.textContent
bt.appendChild(document.createTextNode("content_copy"));
bt.addEventListener("click", () => {
navigator.clipboard.writeText(el.textContent);
navigator.clipboard.writeText(elementTextContent);

// Add a notice that the code was copied
let notice = document.createElement("div");
Expand Down

0 comments on commit c923764

Please sign in to comment.