Skip to content

Commit

Permalink
feat(search): allow enabling detailed view by default
Browse files Browse the repository at this point in the history
closes #2690
  • Loading branch information
brc-dd committed Aug 3, 2023
1 parent 1179484 commit 4af5975
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/client/theme-default/components/VPLocalSearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,15 @@ const filterText = disableQueryPersistence.value
const showDetailedList = useLocalStorage(
'vitepress:local-search-detailed-list',
false
theme.value.search?.provider === 'local' &&
theme.value.search.options?.detailedView === true
)
const disableDetailedView = computed(() => {
return (
theme.value.search?.provider === 'local' &&
theme.value.search.options?.disableDetailedView === true
(theme.value.search.options?.disableDetailedView === true ||
theme.value.search.options?.detailedView === false)
)
})
Expand Down
10 changes: 10 additions & 0 deletions types/default-theme.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,19 @@ export namespace DefaultTheme {
export interface LocalSearchOptions {
/**
* @default false
* @deprecated Use `detailedView: false` instead.
*/
disableDetailedView?: boolean

/**
* If `true`, the detailed view will be enabled by default.
* If `false`, the detailed view will be disabled.
* If `'auto'`, the detailed view will be disabled by default, but can be enabled by the user.
*
* @default 'auto'
*/
detailedView?: boolean | 'auto'

/**
* @default false
*/
Expand Down

0 comments on commit 4af5975

Please sign in to comment.