Updates
This commit is contained in:
@@ -5,14 +5,15 @@ const codeBlocks = document.querySelectorAll("pre");
|
||||
if (codeBlocks) {
|
||||
try {
|
||||
codeBlocks?.forEach((codeBlock) => {
|
||||
if (codeBlock.classList.contains("skip-js")) return;
|
||||
codeBlock.style.position = "relative";
|
||||
|
||||
const copyCodeButton = document.createElement("span");
|
||||
copyCodeButton.style.position = "absolute";
|
||||
copyCodeButton.style.top = "10px";
|
||||
copyCodeButton.style.right = "10px";
|
||||
// copyCodeButton.style.position = "absolute";
|
||||
// copyCodeButton.style.top = "10px";
|
||||
// copyCodeButton.style.right = "10px";
|
||||
copyCodeButton.style.cursor = "pointer";
|
||||
copyCodeButton.style.display = "none";
|
||||
// copyCodeButton.style.display = "none";
|
||||
|
||||
copyCodeButton.addEventListener("click", () => {
|
||||
// console.log(codeBlock.innerText);
|
||||
@@ -30,14 +31,6 @@ if (codeBlocks) {
|
||||
copyCodeButton.appendChild(copyIcon);
|
||||
|
||||
codeBlock.appendChild(copyCodeButton);
|
||||
|
||||
codeBlock.addEventListener("mouseenter", () => {
|
||||
copyCodeButton.style.display = "flex";
|
||||
});
|
||||
|
||||
codeBlock.addEventListener("mouseleave", () => {
|
||||
copyCodeButton.style.display = "none";
|
||||
});
|
||||
});
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user