diff --git a/src/components/postCard/view/postCardView.js b/src/components/postCard/view/postCardView.js index 1df06584d..4b8d628ac 100644 --- a/src/components/postCard/view/postCardView.js +++ b/src/components/postCard/view/postCardView.js @@ -1,8 +1,6 @@ import React, { Component } from 'react'; -import { - Image, TouchableOpacity, Text, View, -} from 'react-native'; -// import FastImage from 'react-native-fast-image'; +import { TouchableOpacity, Text, View } from 'react-native'; +import FastImage from 'react-native-fast-image'; import { PostHeaderDescription } from '../../postElements'; import { PostDropdown } from '../../postDropdown'; import { Icon } from '../../icon'; @@ -84,7 +82,7 @@ class PostCard extends Component { onPress={() => this._handleOnContentPress()} > {!isHideImage && ( - + )} {content.title} diff --git a/src/utils/markdownToHtml.js b/src/utils/markdownToHtml.js index 04a22444f..7c96af94c 100644 --- a/src/utils/markdownToHtml.js +++ b/src/utils/markdownToHtml.js @@ -34,10 +34,9 @@ export const markDown2Html = (input) => { output = createYoutubeIframe(output); } - // Has bug - // if (dTubeRegex.test(output)) { - // output = createDtubeIframe(output); - // } + if (dTubeRegex.test(output)) { + output = createDtubeIframe(output); + } if (pullRightLeftRegex.test(output)) { output = changePullRightLeft(output); @@ -145,10 +144,17 @@ const createYoutubeIframe = input => input.replace(youTubeRegex, (link) => { const createDtubeIframe = input => input.replace(dTubeRegex, (link) => { const execLink = dTubeRegex.exec(link); + const dTubeMatch = link.match(dTubeRegex)[0]; - const embedLink = `https://emb.d.tube/#!/${execLink[2]}/${execLink[3]}`; + if (execLink[2] && execLink[3]) { + const embedLink = `https://emb.d.tube/#!/${execLink[2]}/${execLink[3]}`; - return iframeBody(embedLink); + return iframeBody(embedLink); + } + if (dTubeMatch) { + return iframeBody(dTubeMatch); + } + return link; }); const createVimeoIframe = input => input.replace(vimeoRegex, (link) => { @@ -159,5 +165,5 @@ const createVimeoIframe = input => input.replace(vimeoRegex, (link) => { return iframeBody(embedLink); }); -const iframeBody = link => ``; +const iframeBody = link => ``; const imageBody = link => ``;