chore: Update translations
This commit is contained in:
@ -49,20 +49,20 @@ export default function Text({
|
||||
const images = elements.filter(a => a.type === "media" && a.mimeType?.startsWith("image")).map(a => a.content);
|
||||
|
||||
function renderContentWithHighlightedText(content: string, textToHighlight: string) {
|
||||
const textToHighlightArray = textToHighlight.trim().toLowerCase().split(' ');
|
||||
const re = new RegExp(`(${textToHighlightArray.join('|')})`, 'gi');
|
||||
const textToHighlightArray = textToHighlight.trim().toLowerCase().split(" ");
|
||||
const re = new RegExp(`(${textToHighlightArray.join("|")})`, "gi");
|
||||
const splittedContent = content.split(re);
|
||||
|
||||
const fragments = splittedContent.map(c => {
|
||||
if (textToHighlightArray.includes(c.toLowerCase())) {
|
||||
return {
|
||||
type: 'highlighted_text',
|
||||
type: "highlighted_text",
|
||||
content: c,
|
||||
} as ParsedFragment;
|
||||
}
|
||||
|
||||
return c;
|
||||
})
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -128,9 +128,11 @@ export default function Text({
|
||||
case "custom_emoji":
|
||||
return <ProxyImg src={a.content} size={15} className="custom-emoji" />;
|
||||
default:
|
||||
return <div className="text-frag">
|
||||
{highlighText ? renderContentWithHighlightedText(a.content, highlighText) : a.content}
|
||||
</div>;
|
||||
return (
|
||||
<div className="text-frag">
|
||||
{highlighText ? renderContentWithHighlightedText(a.content, highlighText) : a.content}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user