made eslint happy
Этот коммит содержится в:
@@ -106,11 +106,14 @@ export default class SearchBar extends React.Component {
|
|||||||
if (terms.length) {
|
if (terms.length) {
|
||||||
this.setState({isSearching: true});
|
this.setState({isSearching: true});
|
||||||
|
|
||||||
if(terms.search(/\*\s*$/) == -1) // append * if not present
|
// append * if not present
|
||||||
terms = terms + "*";
|
let searchTerms = terms;
|
||||||
|
if (searchTerms.search(/\*\s*$/) === -1) {
|
||||||
|
searchTerms = searchTerms + '*';
|
||||||
|
}
|
||||||
|
|
||||||
client.search(
|
client.search(
|
||||||
terms,
|
searchTerms,
|
||||||
(data) => {
|
(data) => {
|
||||||
this.setState({isSearching: false});
|
this.setState({isSearching: false});
|
||||||
if (utils.isMobile()) {
|
if (utils.isMobile()) {
|
||||||
|
|||||||
@@ -243,11 +243,10 @@ function autolinkHashtags(text, tokens) {
|
|||||||
|
|
||||||
function highlightSearchTerm(text, tokens, searchTerm) {
|
function highlightSearchTerm(text, tokens, searchTerm) {
|
||||||
let output = text;
|
let output = text;
|
||||||
searchTerm = searchTerm.replace(/\*$/, '');
|
|
||||||
|
|
||||||
var newTokens = new Map();
|
var newTokens = new Map();
|
||||||
for (const [alias, token] of tokens) {
|
for (const [alias, token] of tokens) {
|
||||||
if (token.originalText.indexOf(searchTerm) > -1) {
|
if (token.originalText.indexOf(searchTerm.replace(/\*$/, '')) > -1) {
|
||||||
const index = tokens.size + newTokens.size;
|
const index = tokens.size + newTokens.size;
|
||||||
const newAlias = `MM_SEARCHTERM${index}`;
|
const newAlias = `MM_SEARCHTERM${index}`;
|
||||||
|
|
||||||
@@ -277,7 +276,7 @@ function highlightSearchTerm(text, tokens, searchTerm) {
|
|||||||
return prefix + alias;
|
return prefix + alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
return output.replace(new RegExp(`()(${searchTerm})`, 'gi'), replaceSearchTermWithToken);
|
return output.replace(new RegExp(`()(${searchTerm})`, 'gi'), replaceSearchTermWithToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceTokens(text, tokens) {
|
function replaceTokens(text, tokens) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user