mirror of
https://github.com/leptos-rs/book.git
synced 2025-12-27 11:06:43 -05:00
Add custom admonition for code sandbox (#95)
This commit is contained in:
13
sandbox.js
Normal file
13
sandbox.js
Normal file
@@ -0,0 +1,13 @@
|
||||
(() => {
|
||||
const boxes = document.querySelectorAll("details.admonish-sandbox");
|
||||
boxes.forEach((box) => {
|
||||
const once = () => {
|
||||
const template = box.querySelector("template");
|
||||
const sandbox = template.content.cloneNode(true);
|
||||
template.after(sandbox);
|
||||
|
||||
box.removeEventListener("toggle", once);
|
||||
};
|
||||
box.addEventListener("toggle", once);
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user