mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-23 13:22:02 +03:00
added support to handle markdown-community-link
This commit is contained in:
parent
43d9d324ef
commit
5bb58eb42f
@ -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',
|
||||||
|
@ -53,6 +53,7 @@ export const PostHtmlRenderer = memo(({
|
|||||||
tag,
|
tag,
|
||||||
filter,
|
filter,
|
||||||
videoHref,
|
videoHref,
|
||||||
|
community
|
||||||
} = data;
|
} = data;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -99,6 +100,13 @@ export const PostHtmlRenderer = memo(({
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user