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, proposal?:string,
videoHref?:string, videoHref?:string,
filter?:string, filter?:string,
community?:string,
} }
export const parseLinkData = (tnode:TNode):LinkData => { 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')) { if (tnode.classes.includes('markdown-video-link-youtube')) {
var embedUrl = tnode.attributes['data-embed-src']; var embedUrl = tnode.attributes['data-embed-src'];
if (embedUrl) { if (embedUrl) {
return { return {
type: 'markdown-video-link-youtube', type: 'markdown-video-link-youtube',

View File

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