From c2bea8a4c4aeba440b8a7b043d7ece6343a9d263 Mon Sep 17 00:00:00 2001
From: derfalx <kschneider@falx.tech>
Date: Thu, 08 Jan 2026 01:30:42 +0000
Subject: [PATCH] fix(citation): Language parameter for non en-US settings (#2075)
---
quartz/components/scripts/explorer.inline.ts | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/quartz/components/scripts/explorer.inline.ts b/quartz/components/scripts/explorer.inline.ts
index e9c0a09..9c83411 100644
--- a/quartz/components/scripts/explorer.inline.ts
+++ b/quartz/components/scripts/explorer.inline.ts
@@ -23,11 +23,18 @@
function toggleExplorer(this: HTMLElement) {
const nearestExplorer = this.closest(".explorer") as HTMLElement
if (!nearestExplorer) return
- nearestExplorer.classList.toggle("collapsed")
+ const explorerCollapsed = nearestExplorer.classList.toggle("collapsed")
nearestExplorer.setAttribute(
"aria-expanded",
nearestExplorer.getAttribute("aria-expanded") === "true" ? "false" : "true",
)
+
+ if (!explorerCollapsed) {
+ // Stop <html> from being scrollable when mobile explorer is open
+ document.documentElement.classList.add("mobile-no-scroll")
+ } else {
+ document.documentElement.classList.remove("mobile-no-scroll")
+ }
}
function toggleFolder(evt: MouseEvent) {
@@ -134,9 +141,9 @@
}
for (const child of node.children) {
- const childNode = child.data
- ? createFileNode(currentSlug, child)
- : createFolderNode(currentSlug, child, opts)
+ const childNode = child.isFolder
+ ? createFolderNode(currentSlug, child, opts)
+ : createFileNode(currentSlug, child)
ul.appendChild(childNode)
}
@@ -270,12 +277,25 @@
if (mobileExplorer.checkVisibility()) {
explorer.classList.add("collapsed")
explorer.setAttribute("aria-expanded", "false")
+
+ // Allow <html> to be scrollable when mobile explorer is collapsed
+ document.documentElement.classList.remove("mobile-no-scroll")
}
mobileExplorer.classList.remove("hide-until-loaded")
}
})
+window.addEventListener("resize", function () {
+ // Desktop explorer opens by default, and it stays open when the window is resized
+ // to mobile screen size. Applies `no-scroll` to <html> in this edge case.
+ const explorer = document.querySelector(".explorer")
+ if (explorer && !explorer.classList.contains("collapsed")) {
+ document.documentElement.classList.add("mobile-no-scroll")
+ return
+ }
+})
+
function setFolderState(folderElement: HTMLElement, collapsed: boolean) {
return collapsed ? folderElement.classList.remove("open") : folderElement.classList.add("open")
}
--
Gitblit v1.10.0