{
- initializeGlobal({ navigator: useNavigate() });
+ initializeGlobal({ currentPageName: null, navigator: useNavigate() });
return (
diff --git a/website/src/pages/Playground/preview-parts/Preview/mod.tsx b/website/src/pages/Playground/preview-parts/Preview/mod.tsx
index 1eac7221..f85ca525 100644
--- a/website/src/pages/Playground/preview-parts/Preview/mod.tsx
+++ b/website/src/pages/Playground/preview-parts/Preview/mod.tsx
@@ -16,10 +16,7 @@ import * as Ankor from "ankor";
import { ErrorAlert } from "@rotext/solid-components/internal";
import { debounceEventHandler } from "../../../../utils/mod";
-import {
- PROSE_CLASS,
- registerCustomElementsOnce,
-} from "../../../../custom-elements/mod";
+import { PROSE_CLASS } from "../../../../custom-elements/mod";
import { ActiveLines, EditorStore, TopLine } from "../../editor-store";
import { createAutoResetCounter } from "../../../../hooks/auto-reset-counter";
@@ -28,8 +25,6 @@ import { RotextProcessResult } from "../../../../processors/mod";
import { LookupList, LookupListRaw } from "./internal-types";
import * as ScrollUtils from "./scroll-utils";
-registerCustomElementsOnce();
-
const CONTENT_ROOT_CLASS = "previewer-content-root";
const Preview: Component<
diff --git a/website/src/pages/SyntaxReference/mod.tsx b/website/src/pages/SyntaxReference/mod.tsx
index 597105c7..28e30ffd 100644
--- a/website/src/pages/SyntaxReference/mod.tsx
+++ b/website/src/pages/SyntaxReference/mod.tsx
@@ -16,15 +16,9 @@ import { Button, Card, Loading } from "../../components/ui/mod";
import "../../styles/tuan-prose";
import { syntaxReferenceResourceManager } from "../../resource-managers/syntax-reference";
import { getSyntaxReferencePathOfHeading } from "../../utils/syntax-reference";
-import { initializeGlobal } from "../../global";
-
-import { registerCustomElement as registerCustomElementForRotextPreview } from "./RotextExample/mod";
-
-registerCustomElementForRotextPreview("x-rotext-example");
+import { initializeGlobal, updateGlobalCurrentPageName } from "../../global";
export default (() => {
- initializeGlobal({ navigator: useNavigate() });
-
let contentContainerEl!: HTMLDivElement;
const params = useParams();
@@ -32,6 +26,11 @@ export default (() => {
const navigate = useNavigate();
const location = useLocation();
+ initializeGlobal({ currentPageName: null, navigator: navigate });
+ createEffect(on([pageName], ([pageName]) => {
+ updateGlobalCurrentPageName(pageName);
+ }));
+
const [isIndexLoaded, setIsIndexLoaded] = createSignal(false);
const [pageHTMLRaw] = createResource(
@@ -167,11 +166,13 @@ export default (() => {
)}
-