Article cross-reference linking
This commit is contained in:
@@ -25,6 +25,23 @@ function Panel({ language }: PanelProps) {
|
||||
const articleElement = articleRef.current;
|
||||
if (!articleElement) return;
|
||||
|
||||
// Replace cross-reference links with page navigation
|
||||
const crossRefs = articleElement.querySelectorAll(
|
||||
"a.cross-ref"
|
||||
) as NodeListOf<HTMLAnchorElement>;
|
||||
crossRefs.forEach((link) => {
|
||||
const target = link.getAttribute("data-target");
|
||||
const targetId = link.getAttribute("data-id");
|
||||
|
||||
if (target && targetId) {
|
||||
if (target === "article") {
|
||||
link.setAttribute("href", `../articles/${targetId}`);
|
||||
}
|
||||
} else {
|
||||
console.warn("No target or ID found for link:", link);
|
||||
}
|
||||
});
|
||||
|
||||
const paragraphs = articleElement.querySelectorAll(".paragraph");
|
||||
|
||||
// Highlight the selected paragraph
|
||||
|
||||
Reference in New Issue
Block a user