summaryrefslogtreecommitdiffstats
path: root/webapp/utils/markdown.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-04-22 14:52:44 -0400
committerCorey Hulen <corey@hulen.com>2016-04-22 11:52:44 -0700
commitf73daebb61311efb966afdff75034a7f9c710fbf (patch)
tree0ad2923ade2991586a6f72a90d4a5148bba61be7 /webapp/utils/markdown.jsx
parente80bf13f48a9dba6815558ded39356b1cff584d2 (diff)
downloadchat-f73daebb61311efb966afdff75034a7f9c710fbf.tar.gz
chat-f73daebb61311efb966afdff75034a7f9c710fbf.tar.bz2
chat-f73daebb61311efb966afdff75034a7f9c710fbf.zip
PLT-1236 Added special handling for markdown links within mattermost (#2763)
* Added special handling for markdown links within mattermost * Moved application of .app__body class to route components
Diffstat (limited to 'webapp/utils/markdown.jsx')
-rw-r--r--webapp/utils/markdown.jsx19
1 files changed, 10 insertions, 9 deletions
diff --git a/webapp/utils/markdown.jsx b/webapp/utils/markdown.jsx
index dff425e1f..f2b5bcc39 100644
--- a/webapp/utils/markdown.jsx
+++ b/webapp/utils/markdown.jsx
@@ -2,7 +2,6 @@
// See License.txt for license information.
import * as TextFormatting from './text_formatting.jsx';
-import * as Utils from './utils.jsx';
import * as syntaxHightlighting from './syntax_hightlighting.jsx';
import marked from 'marked';
@@ -137,18 +136,20 @@ class MattermostMarkdownRenderer extends marked.Renderer {
outHref = `http://${outHref}`;
}
- let output = '<a class="theme markdown__link" href="' + outHref + '"';
- if (title) {
- output += ' title="' + title + '"';
- }
+ let output = '<a class="theme markdown__link" ';
- if (outHref.lastIndexOf(Utils.getTeamURLFromAddressBar(), 0) === 0) {
- output += '>';
+ // special case for links that are inside the app
+ if (outHref.startsWith(global.location.origin)) {
+ output += 'data-link="' + outHref.substring(global.location.origin.length) + '"';
} else {
- output += ' target="_blank">';
+ output += 'href="' + outHref + '"';
+ }
+
+ if (title) {
+ output += ' title="' + title + '"';
}
- output += outText + '</a>';
+ output += '>' + outText + '</a>';
return prefix + output + suffix;
}