diff --git a/src/ui/component/common/markdown-preview-internal.jsx b/src/ui/component/common/markdown-preview-internal.jsx index 78af2273d..04701cc6d 100644 --- a/src/ui/component/common/markdown-preview-internal.jsx +++ b/src/ui/component/common/markdown-preview-internal.jsx @@ -1,8 +1,9 @@ // @flow import * as React from 'react'; import remark from 'remark'; -import reactRenderer from 'remark-react'; +import remarkLBRY from 'util/remark-lbry'; import remarkEmoji from 'remark-emoji'; +import reactRenderer from 'remark-react'; import ExternalLink from 'component/externalLink'; import defaultSchema from 'hast-util-sanitize/lib/github.json'; @@ -30,7 +31,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; @@ -44,6 +45,7 @@ const MarkdownPreview = (props: MarkdownProps) => {
{ remark() + .use(remarkLBRY) .use(remarkEmoji) .use(reactRenderer, remarkOptions) .processSync(content).contents diff --git a/src/ui/component/externalLink/view.jsx b/src/ui/component/externalLink/view.jsx index ccab6ad27..632339842 100644 --- a/src/ui/component/externalLink/view.jsx +++ b/src/ui/component/externalLink/view.jsx @@ -20,14 +20,11 @@ class ExternalLink extends React.PureComponent { createLink() { const { href, title, children, openModal } = this.props; - // Regex for url protocol const protocolRegex = new RegExp('^(https?|lbry)+:', '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:')) { element = ( @@ -41,7 +38,6 @@ class ExternalLink extends React.PureComponent { /> ); } - // Return local link if protocol is lbry uri if (protocol && protocol[0] === 'lbry:' && isURIValid(href)) { element =