mirror of
https://github.com/quartz-community/syntax-highlighting.git
synced 2026-07-22 02:50:27 +00:00
feat: add render event listener for in-place DOM re-initialization
This commit is contained in:
parent
3374c99008
commit
4593694be6
1 changed files with 5 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ const svgCopy =
|
|||
const svgCheck =
|
||||
'<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" fill="rgb(63, 185, 80)" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>';
|
||||
|
||||
document.addEventListener("nav", () => {
|
||||
const setupClipboard = () => {
|
||||
const els = document.getElementsByTagName("pre");
|
||||
for (let i = 0; i < els.length; i++) {
|
||||
const el = els[i];
|
||||
|
|
@ -36,4 +36,7 @@ document.addEventListener("nav", () => {
|
|||
el.prepend(button);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
document.addEventListener("nav", setupClipboard);
|
||||
document.addEventListener("render", setupClipboard);
|
||||
|
|
|
|||
Loading…
Reference in a new issue