mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Improved internal links which use react-router (#3180)
This commit is contained in:
committed by
Christopher Speller
parent
a163f8d984
commit
5f7ce2214a
@@ -149,13 +149,13 @@ class MattermostMarkdownRenderer extends marked.Renderer {
|
||||
outHref = `http://${outHref}`;
|
||||
}
|
||||
|
||||
let output = '<a class="theme markdown__link" ';
|
||||
let output = '<a class="theme markdown__link" href="' + outHref + '" rel="noreferrer"';
|
||||
|
||||
// special case for links that are inside the app
|
||||
if (outHref.startsWith(global.location.origin)) {
|
||||
output += 'data-link="' + outHref.substring(global.location.origin.length) + '"';
|
||||
output += ' data-link="' + outHref.substring(global.location.origin.length) + '"';
|
||||
} else {
|
||||
output += 'href="' + outHref + '" target="_blank" rel="noreferrer"';
|
||||
output += ' target="_blank"';
|
||||
}
|
||||
|
||||
if (title) {
|
||||
|
||||
@@ -450,7 +450,13 @@ export function handleClick(e) {
|
||||
} else if (hashtagAttribute) {
|
||||
Utils.searchForTerm(hashtagAttribute.value);
|
||||
} else if (linkAttribute) {
|
||||
browserHistory.push(linkAttribute.value);
|
||||
const MIDDLE_MOUSE_BUTTON = 1;
|
||||
|
||||
if (!(e.button === MIDDLE_MOUSE_BUTTON || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) {
|
||||
e.preventDefault();
|
||||
|
||||
browserHistory.push(linkAttribute.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user