summaryrefslogtreecommitdiffstats
path: root/web/react
diff options
context:
space:
mode:
Diffstat (limited to 'web/react')
-rw-r--r--web/react/utils/markdown.jsx10
-rw-r--r--web/react/utils/text_formatting.jsx7
2 files changed, 15 insertions, 2 deletions
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx
index 7e88f8644..aff776d05 100644
--- a/web/react/utils/markdown.jsx
+++ b/web/react/utils/markdown.jsx
@@ -2,6 +2,7 @@
// See License.txt for license information.
const TextFormatting = require('./text_formatting.jsx');
+const Utils = require('./utils.jsx');
const marked = require('marked');
@@ -39,7 +40,14 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
if (title) {
output += ' title="' + title + '"';
}
- output += ' target="_blank">' + text + '</a>';
+
+ if (outHref.lastIndexOf(Utils.getTeamURLFromAddressBar(), 0) === 0) {
+ output += '>';
+ } else {
+ output += ' target="_blank">';
+ }
+
+ output += text + '</a>';
return output;
}
diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx
index 34e42cbae..b8ed58258 100644
--- a/web/react/utils/text_formatting.jsx
+++ b/web/react/utils/text_formatting.jsx
@@ -96,8 +96,13 @@ function autolinkUrls(text, tokens) {
const index = tokens.size;
const alias = `MM_LINK${index}`;
+ var target = 'target="_blank"';
+ if (url.lastIndexOf(Utils.getTeamURLFromAddressBar(), 0) === 0) {
+ target = '';
+ }
+
tokens.set(alias, {
- value: `<a class='theme' target='_blank' href='${url}'>${linkText}</a>`,
+ value: '<a class="theme"' + target + ' href="${url}">${linkText}</a>',
originalText: linkText
});