PLT-6380 Make team invite links open in the current tab (#6538)
* PLT-6380 Changed link formatting to make team invite links open within the current tab * Fixed internal link parsing when site URL isn't set
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
43c440e8a4
Коммит
e16da499b4
@@ -200,8 +200,15 @@ class MattermostMarkdownRenderer extends marked.Renderer {
|
||||
|
||||
output += '" href="' + outHref + '" rel="noreferrer"';
|
||||
|
||||
// special case for channel links and permalinks that are inside the app
|
||||
if (this.formattingOptions.siteURL && new RegExp('^' + TextFormatting.escapeRegex(this.formattingOptions.siteURL) + '\\/[^\\/]+\\/(pl|channels)\\/').test(outHref)) {
|
||||
// special case for team invite links, channel links, and permalinks that are inside the app
|
||||
let internalLink = false;
|
||||
if (this.formattingOptions.siteURL) {
|
||||
const pattern = new RegExp('^' + TextFormatting.escapeRegex(this.formattingOptions.siteURL) + '\\/(?:signup_user_complete|[^\\/]+\\/(?:pl|channels))\\/');
|
||||
|
||||
internalLink = pattern.test(outHref);
|
||||
}
|
||||
|
||||
if (internalLink) {
|
||||
output += ' data-link="' + outHref.substring(this.formattingOptions.siteURL) + '"';
|
||||
} else {
|
||||
output += ' target="_blank"';
|
||||
|
||||
Ссылка в новой задаче
Block a user