mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-19 19:04:06 -06:00
fix(popover): reset preview scroll position for same-page section links
Signed-off-by: troyejames9 <130838331+TroyeJames9@users.noreply.github.com>
This commit is contained in:
parent
e77a051144
commit
c4aa2eddce
@ -29,6 +29,10 @@ async function mouseEnterHandler(
|
|||||||
popoverElement.classList.add("active-popover")
|
popoverElement.classList.add("active-popover")
|
||||||
setPosition(popoverElement as HTMLElement)
|
setPosition(popoverElement as HTMLElement)
|
||||||
|
|
||||||
|
// ensures always operate on the live DOM element rather than a closed-over variable reference
|
||||||
|
const popoverInner = popoverElement.querySelector(".popover-inner") as HTMLElement | null
|
||||||
|
if (!popoverInner) return
|
||||||
|
|
||||||
if (hash !== "") {
|
if (hash !== "") {
|
||||||
const targetAnchor = `#popover-internal-${hash.slice(1)}`
|
const targetAnchor = `#popover-internal-${hash.slice(1)}`
|
||||||
const heading = popoverInner.querySelector(targetAnchor) as HTMLElement | null
|
const heading = popoverInner.querySelector(targetAnchor) as HTMLElement | null
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user