@apify/docs-theme 1.0.189 → 1.0.191
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/docs-theme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.191",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"docusaurus-gtm-plugin": "^0.0.2",
|
|
30
30
|
"postcss-preset-env": "^10.1.3",
|
|
31
31
|
"prism-react-renderer": "^2.4.1",
|
|
32
|
+
"react-hotkeys-hook": "^5.1.0",
|
|
32
33
|
"remark-parse": "^11.0.0",
|
|
33
34
|
"remark-stringify": "^11.0.0",
|
|
34
35
|
"unified": "^11.0.5",
|
|
@@ -33,7 +33,10 @@ Make sure you are importing the code block contents with the roa-loader.`);
|
|
|
33
33
|
<div className={clsx(styles.container, 'runnable-code-block')}>
|
|
34
34
|
<Link href={href} className={styles.button} rel="follow">
|
|
35
35
|
Run on
|
|
36
|
-
<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" className="apify-logo-light alignMiddle_src-theme-Footer-index-module"
|
|
36
|
+
<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" className="apify-logo-light alignMiddle_src-theme-Footer-index-module">
|
|
37
|
+
{/* eslint-disable-next-line max-len */}
|
|
38
|
+
<path fill="#246DFF" d="M13.785 0h9.889c.201 0 .364.163.364.363v15.074c0 .361-.47.501-.669.2L13.48.561A.363.363 0 0 1 13.785 0Z"/><path fill="#20A34E" d="M10.253 0H.364A.364.364 0 0 0 0 .363v15.074c0 .361.47.501.669.2L10.558.561A.363.363 0 0 0 10.253 0Z"/><path fill="#F86606" d="M11.85 12.069.616 23.358a.363.363 0 0 0 .259.62h22.298a.363.363 0 0 0 .26-.618L12.37 12.07a.365.365 0 0 0-.52-.001Z"/><path className="apify-logo" fill="#000" d="M77.267 3.298H73.06c-1.317 0-1.881.657-1.881 1.853V6.3h6.13l3.503 8.066L84.315 6.3h3.056l-7.335 16.859h-3.009l2.257-5.206-4.195-9.12h-3.91v9.331H68.17V8.832h-3.268V6.3h3.268V4.565c0-2.298 1.27-3.658 3.973-3.658h5.124v2.391Z"/><path className="apify-logo" fill="#000" fill-rule="evenodd" d="M53.32 6.042c3.102 0 5.641 2.321 5.641 6.19 0 3.893-2.538 6.19-5.641 6.19-2.586 0-3.88-1.594-4.114-2.063v6.776h-2.962V6.3h2.985v1.876c.212-.446 1.505-2.134 4.09-2.134Zm-.776 2.626c-2.045 0-3.362 1.524-3.362 3.564 0 2.017 1.316 3.564 3.362 3.564 2.068 0 3.385-1.547 3.385-3.564 0-2.04-1.317-3.564-3.385-3.564ZM38.44 5.995c3.69 0 5.735 1.923 5.735 4.736v4.01c0 .704.259 1.032.94 1.079v2.415h-.94c-1.48-.024-2.445-.587-2.774-1.642-.587.844-1.81 1.83-3.855 1.83-2.797 0-4.913-1.595-4.913-4.01 0-2.392 1.81-3.682 4.748-3.682h3.903c0-1.43-1.105-2.344-2.845-2.344-1.645 0-2.303.89-2.468 1.195h-3.033c.236-1.266 1.764-3.587 5.501-3.587Zm-.565 6.776c-1.387 0-2.28.516-2.28 1.595 0 1.149 1.081 1.829 2.586 1.829 1.692 0 3.103-.844 3.103-2.415V12.77h-3.409Z" clip-rule="evenodd"/><path className="apify-logo" fill="#000" d="M63.47 18.164h-3.009V6.3h3.01v11.864ZM63.518 4.4H60.39V.837h3.127v3.565Z"/>
|
|
39
|
+
</svg>
|
|
37
40
|
</Link>
|
|
38
41
|
<CodeBlock {...props} className={clsx(styles.codeBlock, 'code-block', props.title != null ? 'has-title' : 'no-title')}>
|
|
39
42
|
{ children.code }
|
|
@@ -4,8 +4,8 @@ import RouterLink from '@docusaurus/Link';
|
|
|
4
4
|
// import { useHistory, useLocation } from '@docusaurus/router';
|
|
5
5
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
// import React, { useCallback } from 'react';
|
|
8
7
|
import React, { useEffect, useState } from 'react';
|
|
8
|
+
import { useHotkeys } from 'react-hotkeys-hook';
|
|
9
9
|
|
|
10
10
|
// import { ApifySearch } from '@apify/docs-search-modal';
|
|
11
11
|
import { ControlKeyIcon, SearchIcon } from '@apify/docs-search-modal/dist/utils/icons';
|
|
@@ -82,6 +82,7 @@ export function Link(props) {
|
|
|
82
82
|
|
|
83
83
|
export default function SearchBar({ onClick }) {
|
|
84
84
|
const [variant, setVariant] = useState(null);
|
|
85
|
+
const [opened, setOpened] = useState(false);
|
|
85
86
|
const { siteConfig } = useDocusaurusContext();
|
|
86
87
|
const { inkeepApiKey } = siteConfig.customFields;
|
|
87
88
|
|
|
@@ -98,9 +99,18 @@ export default function SearchBar({ onClick }) {
|
|
|
98
99
|
}, []);
|
|
99
100
|
|
|
100
101
|
onClick = () => {
|
|
102
|
+
if (opened) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
setOpened(true);
|
|
107
|
+
|
|
101
108
|
if (variant === 'kapa') {
|
|
102
109
|
if (window.Kapa && typeof window.Kapa.open === 'function') {
|
|
103
110
|
window.Kapa.open();
|
|
111
|
+
window.Kapa('onModalClose', () => {
|
|
112
|
+
setOpened(false);
|
|
113
|
+
});
|
|
104
114
|
} else {
|
|
105
115
|
console.error('Kapa.ai widget is not available.');
|
|
106
116
|
}
|
|
@@ -178,11 +188,13 @@ export default function SearchBar({ onClick }) {
|
|
|
178
188
|
},
|
|
179
189
|
],
|
|
180
190
|
},
|
|
191
|
+
defaultView: 'chat',
|
|
181
192
|
};
|
|
182
193
|
const modal = window.Inkeep.ModalSearchAndChat(config);
|
|
183
194
|
|
|
184
195
|
function handleOpenChange(newOpen) {
|
|
185
196
|
modal.update({ modalSettings: { isOpen: newOpen } });
|
|
197
|
+
setOpened(newOpen);
|
|
186
198
|
}
|
|
187
199
|
|
|
188
200
|
modal.update({ modalSettings: { isOpen: true } });
|
|
@@ -200,6 +212,10 @@ export default function SearchBar({ onClick }) {
|
|
|
200
212
|
}
|
|
201
213
|
}, []);
|
|
202
214
|
|
|
215
|
+
useHotkeys('mod+k, /', () => {
|
|
216
|
+
onClick();
|
|
217
|
+
}, { preventDefault: true });
|
|
218
|
+
|
|
203
219
|
return (
|
|
204
220
|
<BrowserOnly>
|
|
205
221
|
{() => (
|