append * to search query if not present and highlight partial matches
Этот коммит содержится в:
@@ -243,10 +243,11 @@ function autolinkHashtags(text, tokens) {
|
||||
|
||||
function highlightSearchTerm(text, tokens, searchTerm) {
|
||||
let output = text;
|
||||
searchTerm = searchTerm.replace(/\*$/, '');
|
||||
|
||||
var newTokens = new Map();
|
||||
for (const [alias, token] of tokens) {
|
||||
if (token.originalText === searchTerm) {
|
||||
if (token.originalText.indexOf(searchTerm) > -1) {
|
||||
const index = tokens.size + newTokens.size;
|
||||
const newAlias = `MM_SEARCHTERM${index}`;
|
||||
|
||||
@@ -276,7 +277,7 @@ function highlightSearchTerm(text, tokens, searchTerm) {
|
||||
return prefix + alias;
|
||||
}
|
||||
|
||||
return output.replace(new RegExp(`(^|\\W)(${searchTerm})\\b`, 'gi'), replaceSearchTermWithToken);
|
||||
return output.replace(new RegExp(`()(${searchTerm})`, 'gi'), replaceSearchTermWithToken);
|
||||
}
|
||||
|
||||
function replaceTokens(text, tokens) {
|
||||
|
||||
Ссылка в новой задаче
Block a user