diff options
-rw-r--r-- | web/react/utils/markdown.jsx | 2 | ||||
-rw-r--r-- | web/react/utils/text_formatting.jsx | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx index 074d36b4b..78d2b801d 100644 --- a/web/react/utils/markdown.jsx +++ b/web/react/utils/markdown.jsx @@ -41,7 +41,7 @@ export class MattermostMarkdownRenderer extends marked.Renderer { output += ' title="' + title + '"'; } - if (outHref.indexOf(Utils.getTeamURLFromAddressBar()) === 0) { + if (outHref.lastIndexOf(Utils.getTeamURLFromAddressBar()) === 0) { output += '>'; } else { output += ' target="_blank">'; diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx index 34e42cbae..43b212484 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) { + 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 }); |