Skip to content

Commit 108c888

Browse files
committedJan 24, 2025·
fix(plugin-docsearch): fix search items display
1 parent 37f2ef1 commit 108c888

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed
 

‎plugins/search/plugin-docsearch/src/client/composables/useDocSearchSlim.ts

-29
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ import { removeLeadingSlash, resolveRoutePathFromUrl } from 'vuepress/shared'
55

66
declare const __DOCSEARCH_INDEX_BASE__: string
77

8-
const isSpecialClick = (event: MouseEvent): boolean =>
9-
event.button === 1 ||
10-
event.altKey ||
11-
event.ctrlKey ||
12-
event.metaKey ||
13-
event.shiftKey
14-
158
/**
169
* Get docsearch options to be compatible with VuePress
1710
*/
@@ -32,28 +25,6 @@ export const useDocSearchShim = (): Partial<DocSearchProps> => {
3225
)}`,
3326
})),
3427

35-
// render the hit component with custom `onClick` handler
36-
hitComponent: ({ hit, children }) =>
37-
({
38-
type: 'a',
39-
ref: undefined,
40-
constructor: undefined,
41-
key: undefined,
42-
props: {
43-
href: hit.url,
44-
// handle `onClick` by `router.push`
45-
onClick: (event: MouseEvent) => {
46-
if (isSpecialClick(event)) {
47-
return
48-
}
49-
event.preventDefault()
50-
router.push(hit.url.replace(__VUEPRESS_BASE__, '/'))
51-
},
52-
children: children as unknown,
53-
},
54-
__v: null,
55-
}) as unknown,
56-
5728
// navigation behavior triggered by `onKeyDown` internally
5829
navigator: {
5930
// when pressing Enter without metaKey

0 commit comments

Comments
 (0)
Please sign in to comment.