hanled a tag for img source

This commit is contained in:
u-e 2018-12-28 14:11:27 +03:00
parent 5d8847951f
commit 48cca73a6f
2 changed files with 11 additions and 8 deletions

View File

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

View File

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