#103 - Added a default highlight, as an opt-out setting
This commit is contained in:
@@ -30,6 +30,11 @@
|
|||||||
.omnisearch-highlight {
|
.omnisearch-highlight {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.omnisearch-default-highlight {
|
||||||
|
color: var(--text-normal);
|
||||||
|
background-color: var(--text-highlight-bg);
|
||||||
|
}
|
||||||
|
|
||||||
.omnisearch-input-container {
|
.omnisearch-input-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { EventBus } from './tools/event-bus'
|
import { EventBus } from './tools/event-bus'
|
||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store'
|
||||||
|
import { settings } from './settings'
|
||||||
|
|
||||||
export const regexLineSplit = /\r?\n|\r|((\.|\?|!)( |\r?\n|\r))/g
|
export const regexLineSplit = /\r?\n|\r|((\.|\?|!)( |\r?\n|\r))/g
|
||||||
export const regexYaml = /^---\s*\n(.*?)\n?^---\s?/ms
|
export const regexYaml = /^---\s*\n(.*?)\n?^---\s?/ms
|
||||||
@@ -9,7 +10,9 @@ export const chsRegex = /[\u4e00-\u9fa5]/
|
|||||||
export const excerptBefore = 100
|
export const excerptBefore = 100
|
||||||
export const excerptAfter = 300
|
export const excerptAfter = 300
|
||||||
|
|
||||||
export const highlightClass = 'suggestion-highlight omnisearch-highlight'
|
export const highlightClass = `suggestion-highlight omnisearch-highlight ${
|
||||||
|
settings.hightlight ? 'omnisearch-default-highlight' : ''
|
||||||
|
}`
|
||||||
|
|
||||||
export const eventBus = new EventBus()
|
export const eventBus = new EventBus()
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export interface OmnisearchSettings extends WeightingSettings {
|
|||||||
welcomeMessage: string
|
welcomeMessage: string
|
||||||
/** 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
|
||||||
|
hightlight: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -234,7 +235,9 @@ export class SettingsTab extends PluginSettingTab {
|
|||||||
// Keep line returns in excerpts
|
// Keep line returns in excerpts
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Render line return in excerpts')
|
.setName('Render line return in excerpts')
|
||||||
.setDesc('Activate this option to render line returns in result excerpts.')
|
.setDesc(
|
||||||
|
'Activate this option to render line returns in result excerpts.'
|
||||||
|
)
|
||||||
.addToggle(toggle =>
|
.addToggle(toggle =>
|
||||||
toggle
|
toggle
|
||||||
.setValue(settings.renderLineReturnInExcerpts)
|
.setValue(settings.renderLineReturnInExcerpts)
|
||||||
@@ -284,6 +287,19 @@ export class SettingsTab extends PluginSettingTab {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 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.hightlight).onChange(async v => {
|
||||||
|
settings.hightlight = v
|
||||||
|
await saveSettings(this.plugin)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
//#endregion User Interface
|
//#endregion User Interface
|
||||||
|
|
||||||
//#region Results Weighting
|
//#region Results Weighting
|
||||||
@@ -357,6 +373,7 @@ export const DEFAULT_SETTINGS: OmnisearchSettings = {
|
|||||||
showExcerpt: true,
|
showExcerpt: true,
|
||||||
renderLineReturnInExcerpts: true,
|
renderLineReturnInExcerpts: true,
|
||||||
showCreateButton: false,
|
showCreateButton: false,
|
||||||
|
hightlight: true,
|
||||||
showPreviousQueryResults: true,
|
showPreviousQueryResults: true,
|
||||||
simpleSearch: false,
|
simpleSearch: false,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user