Фикс подсветки ссылок с точками
This commit is contained in:
@@ -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}</>;
|
||||||
|
|||||||
Reference in New Issue
Block a user