From 8bfee04c8c6948a88114d53769d4bb89b8ec7bf5 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sat, 17 Jun 2023 23:05:46 +0000
Subject: [PATCH] popovers

---
 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