added support to handle markdown-community-link

This commit is contained in:
noumantahir 2022-01-12 12:40:57 +05:00
parent 43d9d324ef
commit 5bb58eb42f
2 changed files with 17 additions and 2 deletions

View File

@ -9,6 +9,7 @@ export interface LinkData {
proposal?:string,
videoHref?:string,
filter?:string,
community?:string,
}
export const parseLinkData = (tnode:TNode):LinkData => {
@ -90,11 +91,17 @@ export const parseLinkData = (tnode:TNode):LinkData => {
}
if(tnode.classes.includes('markdown-community-link')){
return {
type: 'markdown-community-link',
community: tnode.attributes['data-community'],
filter: tnode.attributes['data-filter'],
}
}
if (tnode.classes.includes('markdown-video-link-youtube')) {
var embedUrl = tnode.attributes['data-embed-src'];
if (embedUrl) {
return {
type: 'markdown-video-link-youtube',

View File

@ -53,6 +53,7 @@ export const PostHtmlRenderer = memo(({
tag,
filter,
videoHref,
community
} = data;
try {
@ -98,6 +99,13 @@ export const PostHtmlRenderer = memo(({
case 'markdown-proposal-link':
setSelectedLink(href);
break;
case 'markdown-community-link':
//tag press also handles community by default
if(handleTagPress){
handleTagPress(community, filter)
}
break;
default:
break;