diff --git a/CHANGELOG.md b/CHANGELOG.md index 65de39135..760e62ba8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added +- Turn timestamps in a video's description and comments into links _community pr!_ ([#5156](https://github.com/lbryio/lbry-desktop/pull/5156)) - Mobile video player enhancements and the ability to tap on the left and right edges to seek _community pr!_ ([#5119](https://github.com/lbryio/lbry-desktop/pull/5119)) ### Changed diff --git a/ui/component/common/markdown-preview.jsx b/ui/component/common/markdown-preview.jsx index 0a87267c9..26d41555c 100644 --- a/ui/component/common/markdown-preview.jsx +++ b/ui/component/common/markdown-preview.jsx @@ -10,6 +10,7 @@ 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'; type SimpleTextProps = { children?: React.Node, @@ -149,6 +150,8 @@ const MarkdownPreview = (props: MarkdownProps) => { // Note: The order is important .use(formatedLinks) .use(inlineLinks) + .use(isMarkdownPost ? null : inlineTimestamp) + .use(isMarkdownPost ? null : formattedTimestamp) // Emojis .use(remarkEmoji) // Render new lines without needing spaces. diff --git a/ui/component/markdownLink/view.jsx b/ui/component/markdownLink/view.jsx index 130d273e5..2f0ab6986 100644 --- a/ui/component/markdownLink/view.jsx +++ b/ui/component/markdownLink/view.jsx @@ -62,10 +62,27 @@ function MarkdownLink(props: Props) { } } - // Return plain text if no valid url - // Return external link if protocol is http or https - // Return local link if protocol is lbry uri - if (!simpleLinks && ((protocol && protocol[0] === 'lbry:' && isURIValid(decodedUri)) || lbryUrlFromLink)) { + if (href.startsWith('?t=')) { + // Video timestamp markers + element = ( +