mirror of
https://github.com/alrayyes/wiki.git
synced 2025-06-04 05:11:00 +00:00
fix: attempt to merge cached folder state between builds (closes #691)
This commit is contained in:
parent
f68872c09f
commit
76be137283
3 changed files with 68 additions and 97 deletions
quartz/components/scripts
|
@ -16,7 +16,8 @@ const observer = new IntersectionObserver((entries) => {
|
|||
|
||||
function toggleToc(this: HTMLElement) {
|
||||
this.classList.toggle("collapsed")
|
||||
const content = this.nextElementSibling as HTMLElement
|
||||
const content = this.nextElementSibling as HTMLElement | undefined
|
||||
if (!content) return
|
||||
content.classList.toggle("collapsed")
|
||||
content.style.maxHeight = content.style.maxHeight === "0px" ? content.scrollHeight + "px" : "0px"
|
||||
}
|
||||
|
@ -25,7 +26,8 @@ function setupToc() {
|
|||
const toc = document.getElementById("toc")
|
||||
if (toc) {
|
||||
const collapsed = toc.classList.contains("collapsed")
|
||||
const content = toc.nextElementSibling as HTMLElement
|
||||
const content = toc.nextElementSibling as HTMLElement | undefined
|
||||
if (!content) return
|
||||
content.style.maxHeight = collapsed ? "0px" : content.scrollHeight + "px"
|
||||
toc.removeEventListener("click", toggleToc)
|
||||
toc.addEventListener("click", toggleToc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue