Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Commit

Permalink
feat(docsearch): introduce Selection Search
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Apr 4, 2020
1 parent d787c95 commit d5fd4d6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/docsearch-react/src/DocSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ export function DocSearch({
autoFocus: true,
placeholder: 'Search docs...',
openOnFocus: true,
initialState: {
query:
typeof window !== 'undefined'
? window.getSelection()!.toString()
: '',
},
onStateChange({ state }) {
setState(state as any);
},
Expand Down

0 comments on commit d5fd4d6

Please sign in to comment.