fix: explicitly use center div

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham 2024-11-10 10:26:49 -05:00
parent 7995078f66
commit 91c9f635d8
No known key found for this signature in database
GPG Key ID: 18974753009D2BFA

View File

@ -145,7 +145,8 @@ const cssVars = [
] as const ] as const
document.addEventListener("nav", async () => { document.addEventListener("nav", async () => {
const nodes = document.querySelectorAll("code.mermaid") as NodeListOf<HTMLElement> const center = document.querySelector(".center") as HTMLElement
const nodes = center.querySelectorAll("code.mermaid") as NodeListOf<HTMLElement>
if (nodes.length === 0) return if (nodes.length === 0) return
const computedStyleMap = cssVars.reduce( const computedStyleMap = cssVars.reduce(
@ -192,7 +193,7 @@ document.addEventListener("nav", async () => {
pre.prepend(expandBtn) pre.prepend(expandBtn)
// query popup container // query popup container
const popupContainer = document.querySelector("#mermaid-container") as HTMLElement const popupContainer = pre.querySelector("#mermaid-container") as HTMLElement
if (!popupContainer) return if (!popupContainer) return
let panZoom: DiagramPanZoom | null = null let panZoom: DiagramPanZoom | null = null