Фикс подсветки ссылок с точками

This commit is contained in:
RoyceDa
2026-02-17 12:04:53 +02:00
parent 78c7320872
commit d857be6948

View File

@@ -46,10 +46,11 @@ export function TextParser(props: TextParserProps) {
{ {
pattern: [ pattern: [
/(https?:\/\/[^\s]+)/g, /(https?:\/\/[^\s]+)/g,
/\b(?:https?:\/\/)?(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(?:\/[^\s]*)?/g /\b(?:https?:\/\/)?(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(?:\/[\w\-\.\/\?&#=%]*)?/g
], ],
render: (match: string) => { render: (match: string) => {
let domainZone = match.split('.').pop() || ''; let domain = match.replace(/https?:\/\//, '').split('/')[0];
let domainZone = domain.split('.').pop() || '';
domainZone = domainZone.split('/')[0]; domainZone = domainZone.split('/')[0];
if(!ALLOWED_DOMAINS_ZONES.includes(domainZone)) { if(!ALLOWED_DOMAINS_ZONES.includes(domainZone)) {
return <>{match}</>; return <>{match}</>;