Support <http://link|Text>
This commit is contained in:
parent
caf0f2354c
commit
74c0914517
|
@ -57,6 +57,14 @@ const onPress = (attachment) => {
|
||||||
}
|
}
|
||||||
Linking.openURL(attachment.title_link || attachment.author_link);
|
Linking.openURL(attachment.title_link || attachment.author_link);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Support <http://link|Text>
|
||||||
|
const formatText = text =>
|
||||||
|
text.replace(
|
||||||
|
new RegExp('(?:<|<)((?:https|http):\\/\\/[^\\|]+)\\|(.+?)(?=>|>)(?:>|>)', 'gm'),
|
||||||
|
(match, url, title) => `[${ title }](${ url })`
|
||||||
|
);
|
||||||
|
|
||||||
const Reply = ({ attachment, timeFormat }) => {
|
const Reply = ({ attachment, timeFormat }) => {
|
||||||
if (!attachment) {
|
if (!attachment) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -86,7 +94,7 @@ const Reply = ({ attachment, timeFormat }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderText = () => (
|
const renderText = () => (
|
||||||
attachment.text ? <Markdown msg={attachment.text} /> : null
|
attachment.text ? <Markdown msg={formatText(attachment.text)} /> : null
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderFields = () => {
|
const renderFields = () => {
|
||||||
|
|
Loading…
Reference in New Issue