Improved internal links which use react-router (#3180)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
a163f8d984
Коммит
5f7ce2214a
@@ -149,13 +149,13 @@ class MattermostMarkdownRenderer extends marked.Renderer {
|
|||||||
outHref = `http://${outHref}`;
|
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
|
// special case for links that are inside the app
|
||||||
if (outHref.startsWith(global.location.origin)) {
|
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 {
|
} else {
|
||||||
output += 'href="' + outHref + '" target="_blank" rel="noreferrer"';
|
output += ' target="_blank"';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
|
|||||||
@@ -450,8 +450,14 @@ export function handleClick(e) {
|
|||||||
} else if (hashtagAttribute) {
|
} else if (hashtagAttribute) {
|
||||||
Utils.searchForTerm(hashtagAttribute.value);
|
Utils.searchForTerm(hashtagAttribute.value);
|
||||||
} else if (linkAttribute) {
|
} else if (linkAttribute) {
|
||||||
|
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);
|
browserHistory.push(linkAttribute.value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//replace all "/" inside <a> tags to "/<wbr />"
|
//replace all "/" inside <a> tags to "/<wbr />"
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user