mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
fix(popover): inconsistent behavior due to id mismatch
This commit is contained in:
parent
9db66d500e
commit
8deea58ca8
@ -91,7 +91,7 @@ async function mouseEnterHandler(
|
||||
normalizeRelativeURLs(html, targetUrl)
|
||||
// prepend all IDs inside popovers to prevent duplicates
|
||||
html.querySelectorAll("[id]").forEach((el) => {
|
||||
const targetID = `popover-internal-${el.id}`
|
||||
const targetID = `popover-${el.id}`
|
||||
el.id = targetID
|
||||
})
|
||||
const elts = [...html.getElementsByClassName("popover-hint")]
|
||||
@ -106,7 +106,7 @@ async function mouseEnterHandler(
|
||||
document.body.appendChild(popoverElement)
|
||||
|
||||
if (hash !== "") {
|
||||
const targetAnchor = `#popover-internal-${hash.slice(1)}`
|
||||
const targetAnchor = `#popover-${hash.slice(1)}`
|
||||
const heading = popoverInner.querySelector(targetAnchor) as HTMLElement | null
|
||||
if (heading) {
|
||||
// leave ~12px of buffer when scrolling to a heading
|
||||
|
||||
Loading…
Reference in New Issue
Block a user