add Copied text

This commit is contained in:
Arhell 2022-06-04 11:21:38 +03:00
parent c2d154938b
commit 069629bd4a
2 changed files with 13 additions and 0 deletions

View File

@ -34,7 +34,11 @@ function addCopyButtons(clipboard) {
button.title = "Copy Code"
button.addEventListener('click', function () {
clipboard.writeText(codeBlock.innerText).then(function () {
button.classList.add("is-active");
button.blur();
setTimeout(function() {
button.classList.remove("is-active");
}, 2000);
}, function (error) {
});
});

View File

@ -393,8 +393,17 @@ section {
background-repeat: no-repeat;
background-size: cover;
cursor: pointer;
&.is-active {
background-image: none;
width: auto;
&:before {
content: "Copied";
color: #ffffff;
}
}
}
.copy-code-button:hover {
top: 3px;
}