Factor out markdown widget rendering

This commit is contained in:
Zef Hemel
2023-10-29 10:02:50 +01:00
parent 23e99b0c46
commit 50caba8522
17 changed files with 102 additions and 77 deletions
+15
View File
@@ -0,0 +1,15 @@
document.getElementById("root").addEventListener("click", (e) => {
// console.log("Got click", e.target)
const dataSet = e.target.dataset;
if (dataSet["onclick"]) {
syscall("event.dispatch", "preview:click", dataSet["onclick"]).catch((e) =>
console.log("Error", e)
);
} else if (dataSet["pos"]) {
syscall(
"event.dispatch",
"preview:click",
JSON.stringify(["pos", dataSet["pos"]]),
).catch((e) => console.log("Error", e));
}
});