From 08f8e3b4a4879dd7c91c16fbce80c4f2bc5e357f Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 10 Jul 2023 02:32:24 +0000
Subject: [PATCH] docs + various polish
---
quartz/components/scripts/toc.inline.ts | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/quartz/components/scripts/toc.inline.ts b/quartz/components/scripts/toc.inline.ts
index 105889d..d6cd50a 100644
--- a/quartz/components/scripts/toc.inline.ts
+++ b/quartz/components/scripts/toc.inline.ts
@@ -22,11 +22,13 @@
}
function setupToc() {
- const toc = document.getElementById("toc")!
- const content = toc.nextElementSibling as HTMLElement
- content.style.maxHeight = content.scrollHeight + "px"
- toc.removeEventListener("click", toggleToc)
- toc.addEventListener("click", toggleToc)
+ const toc = document.getElementById("toc")
+ if (toc) {
+ const content = toc.nextElementSibling as HTMLElement
+ content.style.maxHeight = content.scrollHeight + "px"
+ toc.removeEventListener("click", toggleToc)
+ toc.addEventListener("click", toggleToc)
+ }
}
window.addEventListener("resize", setupToc)
--
Gitblit v1.10.0