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);
|
||||
};
|
||||
|
||||
// Support <http://link|Text>
|
||||
const formatText = text =>
|
||||
text.replace(
|
||||
new RegExp('(?:<|<)((?:https|http):\\/\\/[^\\|]+)\\|(.+?)(?=>|>)(?:>|>)', 'gm'),
|
||||
(match, url, title) => `[${ title }](${ url })`
|
||||
);
|
||||
|
||||
const Reply = ({ attachment, timeFormat }) => {
|
||||
if (!attachment) {
|
||||
return null;
|
||||
|
@ -86,7 +94,7 @@ const Reply = ({ attachment, timeFormat }) => {
|
|||
};
|
||||
|
||||
const renderText = () => (
|
||||
attachment.text ? <Markdown msg={attachment.text} /> : null
|
||||
attachment.text ? <Markdown msg={formatText(attachment.text)} /> : null
|
||||
);
|
||||
|
||||
const renderFields = () => {
|
||||
|
|
Loading…
Reference in New Issue