From 91059843ae9122bd547ddfdfa5a30edd99a42ff7 Mon Sep 17 00:00:00 2001
From: reagenzn <aiooksa929@gmail.com>
Date: Fri, 01 Aug 2025 15:57:32 +0000
Subject: [PATCH] fix(search): prevent Enter key handling during IME composition (#2070)
---
quartz/plugins/emitters/componentResources.ts | 32 +++++++++++++-------------------
1 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts
index 92794ef..61e2ba8 100644
--- a/quartz/plugins/emitters/componentResources.ts
+++ b/quartz/plugins/emitters/componentResources.ts
@@ -128,28 +128,26 @@
const umamiScript = document.createElement("script");
umamiScript.src = "${cfg.analytics.host ?? "https://analytics.umami.is"}/script.js";
umamiScript.setAttribute("data-website-id", "${cfg.analytics.websiteId}");
- umamiScript.setAttribute("data-auto-track", "false");
+ umamiScript.setAttribute("data-auto-track", "true");
umamiScript.defer = true;
- umamiScript.onload = () => {
- umami.track();
- document.addEventListener("nav", () => {
- umami.track();
- });
- };
document.head.appendChild(umamiScript);
`)
} else if (cfg.analytics?.provider === "goatcounter") {
componentResources.afterDOMLoaded.push(`
+ const goatcounterScriptPre = document.createElement('script');
+ goatcounterScriptPre.textContent = \`
+ window.goatcounter = { no_onload: true };
+ \`;
+ document.head.appendChild(goatcounterScriptPre);
+
+ const endpoint = "https://${cfg.analytics.websiteId}.${cfg.analytics.host ?? "goatcounter.com"}/count";
const goatcounterScript = document.createElement('script');
goatcounterScript.src = "${cfg.analytics.scriptSrc ?? "https://gc.zgo.at/count.js"}";
goatcounterScript.defer = true;
- goatcounterScript.setAttribute(
- 'data-goatcounter',
- "https://${cfg.analytics.websiteId}.${cfg.analytics.host ?? "goatcounter.com"}/count"
- );
+ goatcounterScript.setAttribute('data-goatcounter', endpoint);
goatcounterScript.onload = () => {
- window.goatcounter = { no_onload: true };
+ window.goatcounter.endpoint = endpoint;
goatcounter.count({ path: location.pathname });
document.addEventListener('nav', () => {
goatcounter.count({ path: location.pathname });
@@ -165,14 +163,10 @@
posthog.init('${cfg.analytics.apiKey}', {
api_host: '${cfg.analytics.host ?? "https://app.posthog.com"}',
capture_pageview: false,
- })\`
- posthogScript.onload = () => {
+ });
+ document.addEventListener('nav', () => {
posthog.capture('$pageview', { path: location.pathname });
-
- document.addEventListener('nav', () => {
- posthog.capture('$pageview', { path: location.pathname });
- });
- };
+ })\`
document.head.appendChild(posthogScript);
`)
--
Gitblit v1.10.0