mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-01 07:49:43 +02:00
fix(theme-common): restore useContextualSearchFilters public API for retrocompatibility (#10397)
This commit is contained in:
parent
685730ed32
commit
221ced7242
1 changed files with 11 additions and 0 deletions
|
@ -5,6 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import {DEFAULT_SEARCH_TAG} from './utils/searchUtils';
|
||||
|
||||
// TODO Docusaurus v4: remove these workarounds as a breaking change
|
||||
// and remove docs plugin peerDeps in theme-common/package.json
|
||||
// This is public API surface that we need to keep for v3
|
||||
|
@ -27,6 +30,14 @@ export function useDocsPreferredVersion(...args: unknown[]): unknown {
|
|||
...args,
|
||||
);
|
||||
}
|
||||
export function useContextualSearchFilters() {
|
||||
const {i18n} = useDocusaurusContext();
|
||||
const docsTags =
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
require('@docusaurus/plugin-content-docs/client').useDocsContextualSearchTags();
|
||||
const tags = [DEFAULT_SEARCH_TAG, ...docsTags];
|
||||
return {locale: i18n.currentLocale, tags};
|
||||
}
|
||||
|
||||
/*
|
||||
* APIs to document
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue