diff --git a/app/components/markdown/index.js b/app/components/markdown/index.js
index 6dce3f1c5..954a62bff 100644
--- a/app/components/markdown/index.js
+++ b/app/components/markdown/index.js
@@ -30,7 +30,8 @@ export default class Markdown extends React.PureComponent {
textStyles: PropTypes.object,
blockStyles: PropTypes.object,
emojiSizes: PropTypes.object,
- value: PropTypes.string.isRequired
+ value: PropTypes.string.isRequired,
+ onLongPress: PropTypes.func
};
static defaultProps = {
@@ -57,7 +58,8 @@ export default class Markdown extends React.PureComponent {
text: 65
}
})
- }
+ },
+ onLongPress: () => true
};
constructor(props) {
@@ -75,7 +77,7 @@ export default class Markdown extends React.PureComponent {
emph: Renderer.forwardChildren,
strong: Renderer.forwardChildren,
code: this.renderCodeSpan,
- link: MarkdownLink,
+ link: this.renderLink,
image: this.renderImage,
atMention: this.renderAtMention,
channelLink: this.renderChannelLink,
@@ -259,6 +261,17 @@ export default class Markdown extends React.PureComponent {
return rendered;
}
+ renderLink = ({children, href}) => {
+ return (
+
+ {children}
+
+ );
+ }
+
render() {
const ast = this.parser.parse(this.props.value);
diff --git a/app/components/markdown/markdown_link.js b/app/components/markdown/markdown_link.js
index 4a67bc539..79d8ca0b1 100644
--- a/app/components/markdown/markdown_link.js
+++ b/app/components/markdown/markdown_link.js
@@ -10,9 +10,14 @@ import CustomPropTypes from 'app/constants/custom_prop_types';
export default class MarkdownLink extends PureComponent {
static propTypes = {
children: CustomPropTypes.Children.isRequired,
- href: PropTypes.string.isRequired
+ href: PropTypes.string.isRequired,
+ onLongPress: PropTypes.func
};
+ static defaultProps = {
+ onLongPress: () => true
+ }
+
handlePress = () => {
const url = this.props.href.toLowerCase();
@@ -24,6 +29,13 @@ export default class MarkdownLink extends PureComponent {
};
render() {
- return {this.props.children};
+ return (
+
+ {this.props.children}
+
+ );
}
}
diff --git a/app/components/post/post.js b/app/components/post/post.js
index a4bbfa9fd..25d833efc 100644
--- a/app/components/post/post.js
+++ b/app/components/post/post.js
@@ -390,6 +390,7 @@ class Post extends PureComponent {
textStyles={textStyles}
blockStyles={blockStyles}
value={post.message}
+ onLongPress={this.showOptionsContext}
/>