some odd facet bug

This commit is contained in:
CatAClock 2025-06-11 17:46:27 -07:00
parent 11f8b0c782
commit 079badc75c

View file

@ -349,14 +349,12 @@ export function ApplyFacets(record, text) {
SplitAreas.push(i.index.byteStart);
SplitAreas.push(i.index.byteEnd);
Hrefs.push(i.features[0].uri);
Hrefs.push("");
}
}
// Last minute append.
SplitAreas.push(text.length);
// Remove emoji regex
let EmojiRegex = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu;
let EmojiObjects = text.match(EmojiRegex);
let EmojiObjects = text.match(/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu);
let SubtractNumber = 0;
if (EmojiObjects != null) {
SubtractNumber = EmojiObjects.length * 2;
@ -366,8 +364,12 @@ export function ApplyFacets(record, text) {
StringArray.push(text.slice(SplitAreas[i - 1] - SubtractNumber, SplitAreas[i] - SubtractNumber));
}
// Finally, we append the string with <a>
for (let i = 1; i < StringArray.length; i += 2) {
TempText += StringArray[i - 1] + "<a href='" + Hrefs[i - 1] + "'>" + StringArray[i] + "</a>";
for (let i = 0; i < StringArray.length; i += 2) {
if (Hrefs[(i / 2)] != undefined) {
TempText += StringArray[i] + "<a href='" + Hrefs[(i / 2)] + "'>" + StringArray[i + 1] + "</a>";
} else {
TempText += StringArray[i];
}
}
}
if (TempText == "") {