diff options
author | Robin Appelman <robin@icewind.nl> | 2020-10-08 14:18:20 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2020-10-08 18:36:55 +0200 |
commit | d41a216c498c345ef735276169a1b7399ba89d19 (patch) | |
tree | 0e46158692545a9ba74d708a3fe408f97d8ce447 | |
parent | 2966545f3ed597608f0ff331328455d43d91eb94 (diff) |
link at mentions to external profile page
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | src/components/MessageContent.js | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/components/MessageContent.js b/src/components/MessageContent.js index 2964179d..d2637a41 100644 --- a/src/components/MessageContent.js +++ b/src/components/MessageContent.js @@ -65,7 +65,7 @@ function transformText(createElement, text) { to: { name: 'profile', params: { account: match[2].substr(1) } - } + }, } }, [match[3]] @@ -120,18 +120,12 @@ function cleanLink(createElement, node, context) { case 'mention': var tag = matchMention(context.mentions, node.getAttribute('href'), node.textContent) if (tag) { - return createElement( - 'router-link', - { - props: { - to: { - name: 'profile', - params: { account: tag.name.substr(1) } - } - } - }, - [node.textContent] - ) + attributes['rel'] = 'nofollow noopener noreferrer' + attributes['target'] = '_blank' + attributes['href'] = node.getAttribute('href') + attributes['title'] = tag.name + + return createElement('a', { attrs: attributes }, [transformText(createElement, node.textContent)]) } else { return transformText(createElement, node.textContent) } |