Skip to content

Commit db8fc28

Browse files
committed
Fix stripped external links
1 parent 2a8d5f5 commit db8fc28

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/lib/lexicon/components/EntryView.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
)
100100
.reduce((p, c) => p + c, '');
101101
102-
const match = href?.match(/E-(\d+)/);
102+
const match = href?.match(/^E-(\d+)$/);
103103
if (match) {
104104
const index = parseInt(match[1], 10);
105105
const wordObject = vernacularWords.value.find((item) => item.id === index);
@@ -108,7 +108,11 @@
108108
109109
dataAttributes = ` data-word="${word}" data-index="${index}" data-homonym="${homonymIndex}"`;
110110
}
111-
return `<span class="clickable cursor-pointer"${dataAttributes}>${linkText}</span>`;
111+
if (match || href?.startsWith('#')) {
112+
return `<span class="clickable cursor-pointer"${dataAttributes}>${linkText}</span>`;
113+
} else {
114+
return createElementString(el, parentContainsSenseNumber || isSenseNumber);
115+
}
112116
} else if (el.tagName === 'audio-link' && el.hasAttribute('src')) {
113117
// Handle audio-link tag - create audio element and clickable link
114118
const audioFile = el.getAttribute('src');

0 commit comments

Comments
 (0)