Skip to content

Missing urls like youtube.com #18

@Noitidart

Description

@Noitidart

Is there reason you chose to not catch like youtube.com? Or should we try to find a regex that gets it too? This component I'm using:

const Linkify = memo((props: ILinkifyProps) => {
  return (
    <LinkItPhone>
      <LinkItUrl>
        <LinkItEmail>{props.children}</LinkItEmail>
      </LinkItUrl>
    </LinkItPhone>
  );
});

Linkify.displayName = 'Linkify';

const phoneRegex = /\+?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4,6}/;
const phoneLinkComponent = (match: string, key: number) => (
  <a href={'tel:' + match.replace(/\D/g, '')} key={key}>
    {match}
  </a>
);
const LinkItPhone = memo((props: { children: StrictReactNode }) => {
  return (
    <LinkIt component={phoneLinkComponent} regex={phoneRegex}>
      {props.children}
    </LinkIt>
  );
});
LinkItPhone.displayName = 'LinkItPhone';

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions