mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	fix hangup on highlighting empty tokens, closes #3772
This commit is contained in:
		
							parent
							
								
									a099876088
								
							
						
					
					
						commit
						9881e6de3e
					
				| @ -299,7 +299,9 @@ function highlightSearchResults(searchResults, highlightedTokens) { | ||||
|     // which would make the resulting HTML string invalid.
 | ||||
|     // { and } are used for marking <b> and </b> tag (to avoid matches on single 'b' character)
 | ||||
|     // < and > are used for marking <small> and </small>
 | ||||
|     highlightedTokens = highlightedTokens.map(token => token.replace('/[<\{\}]/g', '')); | ||||
|     highlightedTokens = highlightedTokens | ||||
|         .map(token => token.replace('/[<\{\}]/g', '')) | ||||
|         .filter(token => !!token?.trim()); | ||||
| 
 | ||||
|     // sort by the longest, so we first highlight the longest matches
 | ||||
|     highlightedTokens.sort((a, b) => a.length > b.length ? -1 : 1); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam