Improve word render speed
This commit is contained in:
		
							parent
							
								
									d3c5633821
								
							
						
					
					
						commit
						d5edcaf6a5
					
				
					 1 changed files with 18 additions and 14 deletions
				
			
		| 
						 | 
					@ -28,6 +28,7 @@ export function getSearchFilters() {
 | 
				
			||||||
export function getMatchingSearchWords() {
 | 
					export function getMatchingSearchWords() {
 | 
				
			||||||
  const searchTerm = getSearchTerm();
 | 
					  const searchTerm = getSearchTerm();
 | 
				
			||||||
  const filters = getSearchFilters();
 | 
					  const filters = getSearchFilters();
 | 
				
			||||||
 | 
					  if (searchTerm !== '' || !filters.allPartsOfSpeechChecked) {
 | 
				
			||||||
    const matchingWords = window.currentDictionary.words.slice().filter(word => {
 | 
					    const matchingWords = window.currentDictionary.words.slice().filter(word => {
 | 
				
			||||||
      if (!filters.allPartsOfSpeechChecked) {
 | 
					      if (!filters.allPartsOfSpeechChecked) {
 | 
				
			||||||
        const partOfSpeech = word.partOfSpeech === '' ? 'Unclassified' : word.partOfSpeech;
 | 
					        const partOfSpeech = word.partOfSpeech === '' ? 'Unclassified' : word.partOfSpeech;
 | 
				
			||||||
| 
						 | 
					@ -42,6 +43,9 @@ export function getMatchingSearchWords() {
 | 
				
			||||||
      return searchTerm === '' || isInName || isInDefinition || isInDetails;
 | 
					      return searchTerm === '' || isInName || isInDefinition || isInDetails;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    return matchingWords;
 | 
					    return matchingWords;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  return window.currentDictionary.words
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function highlightSearchTerm(word) {
 | 
					export function highlightSearchTerm(word) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue