Jacky Zhao
2023-07-05 92ca78709227c6117797c52eada7d471bb4ba96a
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)