Jacky Zhao
2023-07-08 b90590b9f487cdd49f019375fa5a09aad2e8ec1f
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)