From 155672ee7b668a767a6da2b122b492fb34ace155 Mon Sep 17 00:00:00 2001 From: btzr-io Date: Wed, 29 May 2019 15:54:47 -0600 Subject: [PATCH 01/30] minor fixes for channel about page fix #2506 fix #2485 --- src/ui/component/channelAbout/view.jsx | 11 +++++++++-- src/ui/scss/component/_media.scss | 1 - 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ui/component/channelAbout/view.jsx b/src/ui/component/channelAbout/view.jsx index 82e8dab90..9d7982b54 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, @@ -16,7 +17,11 @@ function ChannelContent(props: Props) { {!showAbout &&

{__('Nothing here yet')}

} {showAbout && ( - {description &&
{description}
} + {description && ( +
+ +
+ )} {email && (
{__('Contact')}
@@ -26,7 +31,9 @@ function ChannelContent(props: Props) { {website && (
{__('Site')}
-
{website}
+
+ +
)}
diff --git a/src/ui/scss/component/_media.scss b/src/ui/scss/component/_media.scss index b4321fc29..5f4139fc7 100644 --- a/src/ui/scss/component/_media.scss +++ b/src/ui/scss/component/_media.scss @@ -260,7 +260,6 @@ .media__info-text { font-size: 1.15rem; - word-break: break-all; &:not(:last-of-type) { margin-bottom: var(--spacing-vertical-large); From 1edf7e06f91265e85eb2679c223b012dec46f7b5 Mon Sep 17 00:00:00 2001 From: btzr-io Date: Wed, 29 May 2019 17:21:20 -0600 Subject: [PATCH 02/30] add mailto protocol support for external links --- src/ui/component/channelAbout/view.jsx | 13 ++++++++++++- .../component/common/markdown-preview-internal.jsx | 2 +- src/ui/component/externalLink/view.jsx | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/ui/component/channelAbout/view.jsx b/src/ui/component/channelAbout/view.jsx index 9d7982b54..2bde04b87 100644 --- a/src/ui/component/channelAbout/view.jsx +++ b/src/ui/component/channelAbout/view.jsx @@ -8,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; @@ -25,7 +34,9 @@ function ChannelContent(props: Props) { {email && (
{__('Contact')}
-
{email}
+
+ +
)} {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 = (