PLT-4096 Fixed highlighting of hashtags in search (#4043)

* PLT-4096 Fixed highlighting of hashtags in search

* Added unit tests for hashtag rendering on the client
Этот коммит содержится в:
Harrison Healey
2016-09-20 11:59:42 -04:00
коммит произвёл Christopher Speller
родитель b072fdb23f
Коммит e455bee39f
2 изменённых файлов: 165 добавлений и 2 удалений

Просмотреть файл

@@ -415,8 +415,8 @@ function convertSearchTermToRegex(term) {
pattern = '()(' + escapeRegex(term.replace(/\*/g, '')) + ')';
} else if (term.endsWith('*')) {
pattern = '\\b()(' + escapeRegex(term.substring(0, term.length - 1)) + ')';
} else if (term.startsWith('@')) {
// needs special handling of the first boundary because a word boundary doesn't work before an @ sign
} else if (term.startsWith('@') || term.startsWith('#')) {
// needs special handling of the first boundary because a word boundary doesn't work before a symbol
pattern = '(\\W|^)(' + escapeRegex(term) + ')\\b';
} else {
pattern = '\\b()(' + escapeRegex(term) + ')\\b';