Handle timestamp in Markdown.
The videojs player is exposed through the 'window' object.
This commit is contained in:
parent
93709fbeb8
commit
3f1913e5f4
3 changed files with 34 additions and 4 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -18,6 +18,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Turn timestamps in a video's description and comments into links _community pr!_ ([#5156](https://github.com/lbryio/lbry-desktop/pull/5156))
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
## [0.49.0] - [2020-12-10]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
- Better search suggestions ([#5124](https://github.com/lbryio/lbry-desktop/pull/5124))
|
- Better search suggestions ([#5124](https://github.com/lbryio/lbry-desktop/pull/5124))
|
||||||
- Inline video player in comments/markdown posts ([#4894](https://github.com/lbryio/lbry-desktop/pull/4894))
|
- Inline video player in comments/markdown posts ([#4894](https://github.com/lbryio/lbry-desktop/pull/4894))
|
||||||
- Better handling of winning claim + top page improvements ([#4944](https://github.com/lbryio/lbry-desktop/pull/4944))
|
- Better handling of winning claim + top page improvements ([#4944](https://github.com/lbryio/lbry-desktop/pull/4944))
|
||||||
|
|
|
@ -62,10 +62,27 @@ function MarkdownLink(props: Props) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return plain text if no valid url
|
if (href.startsWith('?t=')) {
|
||||||
// Return external link if protocol is http or https
|
// Video timestamp markers
|
||||||
// Return local link if protocol is lbry uri
|
element = (
|
||||||
if (!simpleLinks && ((protocol && protocol[0] === 'lbry:' && isURIValid(decodedUri)) || lbryUrlFromLink)) {
|
<Button
|
||||||
|
button="link"
|
||||||
|
iconRight={undefined}
|
||||||
|
title={title || decodedUri}
|
||||||
|
label={children}
|
||||||
|
className="button--external-link"
|
||||||
|
onClick={() => {
|
||||||
|
if (window.player) {
|
||||||
|
window.player.currentTime(parseInt(href.substr(3)));
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else if (!simpleLinks && ((protocol && protocol[0] === 'lbry:' && isURIValid(decodedUri)) || lbryUrlFromLink)) {
|
||||||
|
// Return plain text if no valid url
|
||||||
|
// Return external link if protocol is http or https
|
||||||
|
// Return local link if protocol is lbry uri
|
||||||
element = (
|
element = (
|
||||||
<ClaimLink
|
<ClaimLink
|
||||||
uri={lbryUrlFromLink || decodedUri}
|
uri={lbryUrlFromLink || decodedUri}
|
||||||
|
|
|
@ -345,6 +345,8 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.player = player;
|
||||||
|
|
||||||
// fixes #3498 (https://github.com/lbryio/lbry-desktop/issues/3498)
|
// fixes #3498 (https://github.com/lbryio/lbry-desktop/issues/3498)
|
||||||
// summary: on firefox the focus would stick to the fullscreen button which caused buggy behavior with spacebar
|
// summary: on firefox the focus would stick to the fullscreen button which caused buggy behavior with spacebar
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
|
@ -357,6 +359,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
|
|
||||||
if (player) {
|
if (player) {
|
||||||
player.dispose();
|
player.dispose();
|
||||||
|
window.player = undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue