fixes #3383 by formatting lbry links differently
This commit is contained in:
parent
b2948674bc
commit
bd4de2fc4e
1 changed files with 20 additions and 1 deletions
|
@ -8,6 +8,8 @@ import reactRenderer from 'remark-react';
|
|||
import ExternalLink from 'component/externalLink';
|
||||
import defaultSchema from 'hast-util-sanitize/lib/github.json';
|
||||
import { formatedLinks, inlineLinks } from 'util/remark-lbry';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
|
||||
type SimpleTextProps = {
|
||||
children?: React.Node,
|
||||
|
@ -30,7 +32,24 @@ const SimpleText = (props: SimpleTextProps) => {
|
|||
};
|
||||
|
||||
const SimpleLink = (props: SimpleLinkProps) => {
|
||||
const { href, title, children } = props;
|
||||
const { title, children } = props;
|
||||
let { href } = props;
|
||||
if (href && href.startsWith('lbry://')) {
|
||||
href = formatLbryUrlForWeb(href);
|
||||
// using NavLink after format to handle "/" vs "#/"
|
||||
// for web and desktop scenarios respectively
|
||||
return (
|
||||
<Link
|
||||
title={title}
|
||||
to={href}
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<a href={href} title={title}>
|
||||
{children}
|
||||
|
|
Loading…
Add table
Reference in a new issue