always highlight tokens
This commit is contained in:
		
							parent
							
								
									88923910aa
								
							
						
					
					
						commit
						080805f714
					
				| 
						 | 
					@ -105,7 +105,6 @@ export function getDefaultSettings(app: App): LocatorSettings {
 | 
				
			||||||
    maxEmbeds: 5,
 | 
					    maxEmbeds: 5,
 | 
				
			||||||
    renderLineReturnInExcerpts: true,
 | 
					    renderLineReturnInExcerpts: true,
 | 
				
			||||||
    showCreateButton: false,
 | 
					    showCreateButton: false,
 | 
				
			||||||
    highlight: true,
 | 
					 | 
				
			||||||
    showPreviousQueryResults: true,
 | 
					    showPreviousQueryResults: true,
 | 
				
			||||||
    simpleSearch: false,
 | 
					    simpleSearch: false,
 | 
				
			||||||
    tokenizeUrls: false,
 | 
					    tokenizeUrls: false,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,17 +82,4 @@ export function injectSettingsUserInterface(
 | 
				
			||||||
        await saveSettings(plugin)
 | 
					        await saveSettings(plugin)
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Highlight results
 | 
					 | 
				
			||||||
  new Setting(containerEl)
 | 
					 | 
				
			||||||
    .setName('Highlight matching words in results')
 | 
					 | 
				
			||||||
    .setDesc(
 | 
					 | 
				
			||||||
      'Will highlight matching results when enabled. See README for more customization options.'
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
    .addToggle(toggle =>
 | 
					 | 
				
			||||||
      toggle.setValue(settings.highlight).onChange(async v => {
 | 
					 | 
				
			||||||
        settings.highlight = v
 | 
					 | 
				
			||||||
        await saveSettings(plugin)
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,6 @@ export interface LocatorSettings extends WeightingSettings {
 | 
				
			||||||
  /** If a query returns 0 result, try again with more relax conditions */
 | 
					  /** If a query returns 0 result, try again with more relax conditions */
 | 
				
			||||||
  simpleSearch: boolean
 | 
					  simpleSearch: boolean
 | 
				
			||||||
  tokenizeUrls: boolean
 | 
					  tokenizeUrls: boolean
 | 
				
			||||||
  highlight: boolean
 | 
					 | 
				
			||||||
  splitCamelCase: boolean
 | 
					  splitCamelCase: boolean
 | 
				
			||||||
  openInNewPane: boolean
 | 
					  openInNewPane: boolean
 | 
				
			||||||
  verboseLogging: boolean
 | 
					  verboseLogging: boolean
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,9 +15,7 @@ export class TextProcessor {
 | 
				
			||||||
   * @returns The html string with the matches highlighted
 | 
					   * @returns The html string with the matches highlighted
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  public highlightText(text: string, matches: SearchMatch[]): string {
 | 
					  public highlightText(text: string, matches: SearchMatch[]): string {
 | 
				
			||||||
    const highlightClass = `suggestion-highlight locator-highlight ${
 | 
					    const highlightClass = 'suggestion-highlight locator-highlight locator-default-highlight'
 | 
				
			||||||
      this.plugin.settings.highlight ? 'locator-default-highlight' : ''
 | 
					 | 
				
			||||||
    }`
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!matches.length) {
 | 
					    if (!matches.length) {
 | 
				
			||||||
      return text
 | 
					      return text
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user