From fd5c8d17d3b3cd0a13b0a21a2b78d85010e02e12 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Tue, 20 Jun 2023 03:37:45 +0000
Subject: [PATCH] basic search implementation

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