hanled a tag for img source

This commit is contained in:
u-e 2018-12-28 14:11:27 +03:00
parent 1a4f6fe8ce
commit e489f72af4
2 changed files with 11 additions and 8 deletions

View File

@ -50,9 +50,7 @@ class PostCardContainer extends PureComponent {
navigation.navigate({
routeName: ROUTES.SCREENS.POST,
params: {
// content,
permlink: content.permlink,
author: content.author,
content,
},
key: content.permlink,
});

View File

@ -40,10 +40,6 @@ export const markDown2Html = (input) => {
output = createYoutubeIframe(output);
}
if (aTagRegex.test(output)) {
output = handleATag(output);
}
if (imgTagRegex.test(output)) {
output = handleImageTag(output);
}
@ -76,6 +72,10 @@ export const markDown2Html = (input) => {
output = handleLinks(output);
}
if (aTagRegex.test(output)) {
output = handleATag(output);
}
output = md.render(output);
return output;
@ -112,6 +112,12 @@ const handleATag = input => input.replace(aTagRegex, (link) => {
return link;
}
if (imgRegex.test(link)) {
const imgMatch = link.match(imgRegex)[0];
if (imgMatch) return `<a src="${imgMatch}">Image</a>`;
}
return link;
});
@ -208,7 +214,6 @@ const handleIframe = input => input.replace(iframeRegex, (link) => {
const match = link.match(linkRegex);
if (match && match[0]) {
return iframeBody(match[0]);
}