// @flow import * as React from 'react'; import classnames from 'classnames'; import remark from 'remark'; import remarkAttr from 'remark-attr'; import remarkStrip from 'strip-markdown'; import remarkEmoji from 'remark-emoji'; import remarkBreaks from 'remark-breaks'; import remarkFrontMatter from 'remark-frontmatter'; import reactRenderer from 'remark-react'; import MarkdownLink from 'component/markdownLink'; import defaultSchema from 'hast-util-sanitize/lib/github.json'; import { formatedLinks, inlineLinks } from 'util/remark-lbry'; import { formattedTimestamp, inlineTimestamp } from 'util/remark-timestamp'; import ZoomableImage from 'component/zoomableImage'; import { CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS } from 'config'; import Button from 'component/button'; import * as ICONS from 'constants/icons'; import { parse } from 'node-html-parser'; type SimpleTextProps = { children?: React.Node, }; type SimpleLinkProps = { href?: string, title?: string, children?: React.Node, }; type ImageLinkProps = { src: string, title?: string, alt?: string, helpText?: string, }; type MarkdownProps = { strip?: boolean, content: ?string, simpleLinks?: boolean, noDataStore?: boolean, className?: string, parentCommentId?: string, isMarkdownPost?: boolean, stakedLevel?: number, }; // **************************************************************************** // **************************************************************************** const SimpleText = (props: SimpleTextProps) => { return {props.children}; }; // **************************************************************************** // **************************************************************************** const SimpleLink = (props: SimpleLinkProps) => { const { title, children, href } = props; if (!href) { return children || null; } if (!href.startsWith('lbry:/')) { return ( {children} ); } const [uri, search] = href.split('?'); const urlParams = new URLSearchParams(search); const embed = urlParams.get('embed'); if (embed) { // Decode this since users might just copy it from the url bar const decodedUri = decodeURI(uri); return (
{decodedUri}
); } // Dummy link (no 'href') return {children}; }; // **************************************************************************** // **************************************************************************** const SimpleImageLink = (props: ImageLinkProps) => { const { src, title, alt, helpText } = props; if (!src) { return null; } return (