From 74777118a7fd19e4a296706c2a4b5fdca546c4fa Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Tue, 14 Nov 2023 06:51:40 +0000
Subject: [PATCH] feat: header and full-page transcludes (closes #557)
---
quartz/components/scripts/popover.inline.ts | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/quartz/components/scripts/popover.inline.ts b/quartz/components/scripts/popover.inline.ts
index ed3c925..9506ec4 100644
--- a/quartz/components/scripts/popover.inline.ts
+++ b/quartz/components/scripts/popover.inline.ts
@@ -28,8 +28,11 @@
})
}
+ const hasAlreadyBeenFetched = () =>
+ [...link.children].some((child) => child.classList.contains("popover"))
+
// dont refetch if there's already a popover
- if ([...link.children].some((child) => child.classList.contains("popover"))) {
+ if (hasAlreadyBeenFetched()) {
return setPosition(link.lastChild as HTMLElement)
}
@@ -49,6 +52,11 @@
console.error(err)
})
+ // bailout if another popover exists
+ if (hasAlreadyBeenFetched()) {
+ return
+ }
+
if (!contents) return
const html = p.parseFromString(contents, "text/html")
normalizeRelativeURLs(html, targetUrl)
--
Gitblit v1.10.0