added support to play inline youtube video content in app builtin player

This commit is contained in:
noumantahir 2022-01-13 12:44:21 +05:00
parent 216a6b3738
commit 71b3a33623

View File

@ -19,10 +19,24 @@ export const parseLinkData = (tnode:TNode):LinkData => {
}
if(tnode.classes.includes('markdown-external-link')){
//inline external links can contain video links, for such tags and video id or url is contained as
//attribute if that is the case, use in app video modal to play content
//for now, only youtube id is supported
const youtubeId = tnode.attributes['data-youtube']
if(youtubeId){
return {
type:'markdown-external-link',
href: tnode.attributes['data-href']
type:'markdown-video-link-youtube',
youtubeId:youtubeId.length > 11 && youtubeId[12] === '?' ? youtubeId.substring(0,11):youtubeId //this is a workaround to avoid feeding query parameters to youtube player
}
}
//TOOD: support other video link later
//use default markdown-external-link with url;
return {
type:'markdown-external-link',
href: tnode.attributes['data-href']
}
}