Merge pull request #2352 from hmhealey/plt2139
PLT-2139 Stopped removing extra punctuation after @mentions
Этот коммит содержится в:
@@ -123,14 +123,13 @@ function autolinkAtMentions(text, tokens) {
|
|||||||
return (Constants.SPECIAL_MENTIONS.indexOf(u) !== -1 || UserStore.getProfileByUsername(u));
|
return (Constants.SPECIAL_MENTIONS.indexOf(u) !== -1 || UserStore.getProfileByUsername(u));
|
||||||
}
|
}
|
||||||
|
|
||||||
function addToken(username, mention, extraText) {
|
function addToken(username, mention) {
|
||||||
const index = tokens.size;
|
const index = tokens.size;
|
||||||
const alias = `MM_ATMENTION${index}`;
|
const alias = `MM_ATMENTION${index}`;
|
||||||
|
|
||||||
tokens.set(alias, {
|
tokens.set(alias, {
|
||||||
value: `<a class='mention-link' href='#' data-mention='${username}'>${mention}</a>`,
|
value: `<a class='mention-link' href='#' data-mention='${username}'>${mention}</a>`,
|
||||||
originalText: mention,
|
originalText: mention
|
||||||
extraText
|
|
||||||
});
|
});
|
||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
@@ -152,9 +151,9 @@ function autolinkAtMentions(text, tokens) {
|
|||||||
usernameLower = usernameLower.substring(0, c - 1);
|
usernameLower = usernameLower.substring(0, c - 1);
|
||||||
|
|
||||||
if (mentionExists(usernameLower)) {
|
if (mentionExists(usernameLower)) {
|
||||||
const extraText = originalUsername.substr(c - 1);
|
const suffix = originalUsername.substr(c - 1);
|
||||||
const alias = addToken(usernameLower, '@' + usernameLower, extraText);
|
const alias = addToken(usernameLower, '@' + usernameLower);
|
||||||
return alias;
|
return alias + suffix;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If the last character is not punctuation, no point in going any further
|
// If the last character is not punctuation, no point in going any further
|
||||||
@@ -188,7 +187,7 @@ function highlightCurrentMentions(text, tokens) {
|
|||||||
const newAlias = `MM_SELFMENTION${index}`;
|
const newAlias = `MM_SELFMENTION${index}`;
|
||||||
|
|
||||||
newTokens.set(newAlias, {
|
newTokens.set(newAlias, {
|
||||||
value: `<span class='mention-highlight'>${alias}</span>` + (token.extraText || ''),
|
value: `<span class='mention-highlight'>${alias}</span>`,
|
||||||
originalText: token.originalText
|
originalText: token.originalText
|
||||||
});
|
});
|
||||||
output = output.replace(alias, newAlias);
|
output = output.replace(alias, newAlias);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user