diff --git a/src/ui/component/channelAbout/view.jsx b/src/ui/component/channelAbout/view.jsx index 82e8dab90..5965c896c 100644 --- a/src/ui/component/channelAbout/view.jsx +++ b/src/ui/component/channelAbout/view.jsx @@ -1,5 +1,6 @@ // @flow import React, { Fragment } from 'react'; +import MarkdownPreview from 'component/common/markdown-preview'; type Props = { description: ?string, @@ -7,6 +8,15 @@ type Props = { website: ?string, }; +const formatEmail = (email: string) => { + if (email) { + const protocolRegex = new RegExp('^mailto:', 'i'); + const protocol = protocolRegex.exec(email); + return protocol ? email : `mailto:${email}`; + } + return null; +}; + function ChannelContent(props: Props) { const { description, email, website } = props; const showAbout = description || email || website; @@ -16,17 +26,25 @@ function ChannelContent(props: Props) { {!showAbout &&

{__('Nothing here yet')}

} {showAbout && ( - {description &&
{description}
} + {description && ( +
+ +
+ )} {email && (
{__('Contact')}
-
{email}
+
+ +
)} {website && (
{__('Site')}
-
{website}
+
+ +
)}
diff --git a/src/ui/component/common/markdown-preview-internal.jsx b/src/ui/component/common/markdown-preview-internal.jsx index 78af2273d..8acf727bb 100644 --- a/src/ui/component/common/markdown-preview-internal.jsx +++ b/src/ui/component/common/markdown-preview-internal.jsx @@ -30,7 +30,7 @@ const SimpleLink = (props: SimpleLinkProps) => { const schema = { ...defaultSchema }; // Extend sanitation schema to support lbry protocol -schema.protocols.href[3] = 'lbry'; +schema.protocols.href.push('lbry'); const MarkdownPreview = (props: MarkdownProps) => { const { content, promptLinks } = props; diff --git a/src/ui/component/externalLink/view.jsx b/src/ui/component/externalLink/view.jsx index ccab6ad27..36607e9ad 100644 --- a/src/ui/component/externalLink/view.jsx +++ b/src/ui/component/externalLink/view.jsx @@ -22,14 +22,14 @@ class ExternalLink extends React.PureComponent { const { href, title, children, openModal } = this.props; // Regex for url protocol - const protocolRegex = new RegExp('^(https?|lbry)+:', 'i'); + const protocolRegex = new RegExp('^(https?|lbry|mailto)+:', 'i'); const protocol = href ? protocolRegex.exec(href) : null; // Return plain text if no valid url let element = {children}; // Return external link if protocol is http or https - if (protocol && (protocol[0] === 'http:' || protocol[0] === 'https:')) { + if (protocol && (protocol[0] === 'http:' || protocol[0] === 'https:' || protocol[0] === 'mailto:')) { element = (