From 9acaa1c8ac8c8afd3fa08d3b1f58a60006fcfc6f Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 09 Aug 2024 01:19:45 +0000
Subject: [PATCH] feat: custom global latex macros (closes #1325)
---
quartz/components/scripts/popover.inline.ts | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/quartz/components/scripts/popover.inline.ts b/quartz/components/scripts/popover.inline.ts
index dee0a78..49f4382 100644
--- a/quartz/components/scripts/popover.inline.ts
+++ b/quartz/components/scripts/popover.inline.ts
@@ -3,7 +3,7 @@
const p = new DOMParser()
async function mouseEnterHandler(
- this: HTMLLinkElement,
+ this: HTMLAnchorElement,
{ clientX, clientY }: { clientX: number; clientY: number },
) {
const link = this
@@ -33,7 +33,7 @@
thisUrl.hash = ""
thisUrl.search = ""
const targetUrl = new URL(link.href)
- const hash = targetUrl.hash
+ const hash = decodeURIComponent(targetUrl.hash)
targetUrl.hash = ""
targetUrl.search = ""
@@ -61,10 +61,7 @@
switch (contentTypeCategory) {
case "image":
const img = document.createElement("img")
-
- response.blob().then((blob) => {
- img.src = URL.createObjectURL(blob)
- })
+ img.src = targetUrl.toString()
img.alt = targetUrl.pathname
popoverInner.appendChild(img)
@@ -103,7 +100,7 @@
}
document.addEventListener("nav", () => {
- const links = [...document.getElementsByClassName("internal")] as HTMLLinkElement[]
+ const links = [...document.getElementsByClassName("internal")] as HTMLAnchorElement[]
for (const link of links) {
link.addEventListener("mouseenter", mouseEnterHandler)
window.addCleanup(() => link.removeEventListener("mouseenter", mouseEnterHandler))
--
Gitblit v1.10.0