diff options
Diffstat (limited to 'web/react/utils')
-rw-r--r-- | web/react/utils/async_client.jsx | 2 | ||||
-rw-r--r-- | web/react/utils/constants.jsx | 2 | ||||
-rw-r--r-- | web/react/utils/emoticons.jsx | 2 | ||||
-rw-r--r-- | web/react/utils/markdown.jsx | 12 | ||||
-rw-r--r-- | web/react/utils/text_formatting.jsx | 9 | ||||
-rw-r--r-- | web/react/utils/utils.jsx | 2 |
6 files changed, 21 insertions, 8 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index 7db3ef30d..a903f055b 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. var client = require('./client.jsx'); diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index 8fd0ab79b..affc49196 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. var keyMirror = require('keymirror'); diff --git a/web/react/utils/emoticons.jsx b/web/react/utils/emoticons.jsx index 508166af9..94bb91503 100644 --- a/web/react/utils/emoticons.jsx +++ b/web/react/utils/emoticons.jsx @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. const emoticonPatterns = { diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx index 7e88f8644..12d6dd424 100644 --- a/web/react/utils/markdown.jsx +++ b/web/react/utils/markdown.jsx @@ -1,7 +1,8 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // 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..a90a8bcc1 100644 --- a/web/react/utils/text_formatting.jsx +++ b/web/react/utils/text_formatting.jsx @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. const Autolinker = require('autolinker'); @@ -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 }); diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index f79f3492f..f9166063e 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); |