@apify/docs-theme 1.0.69 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,10 +4,7 @@ import { DocSearchButton, useDocSearchKeyboardEvents } from '@docsearch/react';
|
|
|
4
4
|
import Head from '@docusaurus/Head';
|
|
5
5
|
import Link from '@docusaurus/Link';
|
|
6
6
|
import { useSearchPage } from '@docusaurus/theme-common/internal';
|
|
7
|
-
import {
|
|
8
|
-
useAlgoliaContextualFacetFilters,
|
|
9
|
-
useSearchResultUrlProcessor,
|
|
10
|
-
} from '@docusaurus/theme-search-algolia/client';
|
|
7
|
+
import { useAlgoliaContextualFacetFilters } from '@docusaurus/theme-search-algolia/client';
|
|
11
8
|
import { useActiveDocContext } from '@docusaurus/plugin-content-docs/client';
|
|
12
9
|
import Translate from '@docusaurus/Translate';
|
|
13
10
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
@@ -17,22 +14,24 @@ import translations from '@theme/SearchTranslations';
|
|
|
17
14
|
let DocSearchModal = null;
|
|
18
15
|
|
|
19
16
|
function A(props) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
const { siteConfig } = useDocusaurusContext();
|
|
18
|
+
if (props.href.startsWith(siteConfig.baseUrl)) {
|
|
19
|
+
return <Link {...props}>
|
|
20
|
+
{props.children}
|
|
21
|
+
</Link>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return <a {...props}>{props.children}</a>;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
function Hit({ hit, children }) {
|
|
29
|
-
return <A
|
|
28
|
+
return <A href={hit.url}>{children}</A>;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
function ResultsFooter({ state, onClose }) {
|
|
33
32
|
const { generateSearchPageLink } = useSearchPage();
|
|
34
33
|
return (
|
|
35
|
-
<A
|
|
34
|
+
<A href={generateSearchPageLink(state.query)} onClick={onClose}>
|
|
36
35
|
<Translate
|
|
37
36
|
id="theme.SearchBar.seeAll"
|
|
38
37
|
values={{ count: state.context.nbHits }}>
|
|
@@ -49,7 +48,6 @@ function mergeFacetFilters(f1, f2) {
|
|
|
49
48
|
|
|
50
49
|
function DocSearch({ contextualSearch, externalUrlRegex, ...props }) {
|
|
51
50
|
const { siteMetadata, siteConfig } = useDocusaurusContext();
|
|
52
|
-
const processSearchResultUrl = useSearchResultUrlProcessor();
|
|
53
51
|
const contextualSearchFacetFilters = useAlgoliaContextualFacetFilters();
|
|
54
52
|
const configFacetFilters = props.searchParameters?.facetFilters ?? [];
|
|
55
53
|
const facetFilters = contextualSearch
|
|
@@ -120,15 +118,12 @@ function DocSearch({ contextualSearch, externalUrlRegex, ...props }) {
|
|
|
120
118
|
window.location.href = itemUrl;
|
|
121
119
|
},
|
|
122
120
|
}).current;
|
|
123
|
-
const transformItems = useRef((items) => (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
url: processSearchResultUrl(item.url).replace(new RegExp(`^${siteConfig.baseUrl}`), '/'),
|
|
130
|
-
}))),
|
|
131
|
-
).current;
|
|
121
|
+
const transformItems = useRef((items) => (items.map((item) => {
|
|
122
|
+
if (item.url.startsWith(siteConfig.url)) {
|
|
123
|
+
return { ...item, url: item.url.substring(siteConfig.url.length) };
|
|
124
|
+
}
|
|
125
|
+
return item;
|
|
126
|
+
}))).current;
|
|
132
127
|
const resultsFooterComponent = useMemo(
|
|
133
128
|
() =>
|
|
134
129
|
// eslint-disable-next-line react/no-unstable-nested-components,react/display-name,implicit-arrow-linebreak
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Head from '@docusaurus/Head';
|
|
3
3
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
4
|
-
import {
|
|
4
|
+
import { useThemeConfig } from '@docusaurus/theme-common';
|
|
5
5
|
|
|
6
6
|
export default function SearchMetadata({ locale, version, tag }) {
|
|
7
7
|
const { siteConfig } = useDocusaurusContext();
|
|
@@ -10,12 +10,11 @@ export default function SearchMetadata({ locale, version, tag }) {
|
|
|
10
10
|
// keep the tag on same value for all the content, and add a new section + section tag
|
|
11
11
|
const section = siteConfig.projectName;
|
|
12
12
|
const sectionTag = tag;
|
|
13
|
-
const
|
|
14
|
-
const activeDocContext = useActiveDocContext(docsPluginId);
|
|
13
|
+
const { versions } = useThemeConfig();
|
|
15
14
|
|
|
16
15
|
// normalize the latest version regardless of what number it has,
|
|
17
16
|
// so we can search across all "latest versions of the docs"
|
|
18
|
-
if (!version || !
|
|
17
|
+
if (!version || !versions || version === versions[0]) {
|
|
19
18
|
version = 'latest';
|
|
20
19
|
}
|
|
21
20
|
|