Skip to content
This repository has been archived by the owner on Dec 15, 2024. It is now read-only.

Add header to code block #22

Open
laurentkempe opened this issue Mar 24, 2022 · 0 comments
Open

Add header to code block #22

laurentkempe opened this issue Mar 24, 2022 · 0 comments
Milestone

Comments

@laurentkempe
Copy link
Owner

From @meziantou

function copyCodeBlock(elt, id) {
    navigator.clipboard.writeText(document.getElementById(id).textContent)
        .then(() => {
            elt.disabled = true;
            var body = elt.innerHTML;
            elt.innerHTML = "copied";
            setTimeout(() => {
                elt.innerHTML = body;
                elt.disabled = false;
            }, 1000)
        });
}
@laurentkempe laurentkempe added this to the 1.1 milestone Mar 24, 2022
@laurentkempe laurentkempe changed the title Rework the copy to clipboard Add header to code block Mar 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant