Skip to content

Commit 5467e37

Browse files
committed
Merge branch 'main' of github.com:strapi/documentation
2 parents f695c92 + 9530593 commit 5467e37

File tree

2 files changed

+41
-16
lines changed

2 files changed

+41
-16
lines changed

.github/workflows/meilisearch-scraper.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ on:
88
types: [closed]
99
branches:
1010
- main
11-
workflow_dispatch: # Manual trigger option
11+
workflow_dispatch:
1212
schedule:
13-
- cron: '0 2 * * *' # Daily at 2 AM UTC
13+
- cron: '0 2 * * *'
1414

1515
jobs:
1616
scrape-docs:
1717
runs-on: ubuntu-latest
18-
# Only run on main branch or merged PRs
1918
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
2019

2120
steps:
@@ -24,21 +23,25 @@ jobs:
2423

2524
- name: Wait for deployment (if push event)
2625
if: github.event_name == 'push'
27-
run: sleep 60 # Wait for Vercel/Netlify deployment
26+
run: sleep 60
27+
28+
- name: Validate JSON config
29+
run: |
30+
echo "Validating JSON configuration..."
31+
python3 -c "import json; json.load(open('.github/workflows/meilisearch-scraper-config.json'))"
32+
echo "JSON is valid!"
2833
2934
- name: Run Meilisearch Scraper
3035
env:
3136
MEILISEARCH_HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }}
3237
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_MASTER_KEY }}
33-
CONFIG_FILE: .github/meilisearch/scraper-config.json
3438
run: |
35-
run: |
36-
docker run \
37-
-e MEILISEARCH_HOST_URL="$MEILISEARCH_HOST_URL" \
38-
-e MEILISEARCH_API_KEY="$MEILISEARCH_API_KEY" \
39-
-v ${{ github.workspace }}/.github:/config \
40-
getmeili/docs-scraper:v0.12.8 \
41-
pipenv run ./docs_scraper /config/meilisearch-scraper-config.json
39+
docker run \
40+
-e MEILISEARCH_HOST_URL="$MEILISEARCH_HOST_URL" \
41+
-e MEILISEARCH_API_KEY="$MEILISEARCH_API_KEY" \
42+
-v ${{ github.workspace }}/.github/workflows:/config \
43+
getmeili/docs-scraper:v0.12.8 \
44+
pipenv run ./docs_scraper /config/meilisearch-scraper-config.json
4245
4346
- name: Test search index
4447
env:
@@ -55,4 +58,4 @@ jobs:
5558
echo "Checking index stats..."
5659
curl -s "$MEILISEARCH_HOST_URL/indexes/strapi-docs/stats" \
5760
-H "Authorization: Bearer $MEILISEARCH_SEARCH_KEY" | \
58-
python3 -m json.tool
61+
python3 -m json.tool

docusaurus/src/theme/SearchBar/index.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,37 @@ function SearchBarContent() {
1616
return;
1717
}
1818

19-
// Clean up previous instance and clear container
19+
const handleKeyDown = (e) => {
20+
const kapaContainer = document.getElementById('kapa-widget-container');
21+
22+
if (!kapaContainer || !kapaContainer.shadowRoot) {
23+
return;
24+
}
25+
26+
const shadowActiveElement = kapaContainer.shadowRoot.activeElement;
27+
28+
if (shadowActiveElement &&
29+
(shadowActiveElement.tagName === 'INPUT' ||
30+
shadowActiveElement.tagName === 'TEXTAREA' ||
31+
shadowActiveElement.isContentEditable)) {
32+
33+
const allowedKeys = ['Enter', 'Tab', 'Escape', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
34+
35+
if (!allowedKeys.includes(e.key)) {
36+
e.stopImmediatePropagation();
37+
}
38+
}
39+
};
40+
41+
document.addEventListener('keydown', handleKeyDown, true);
42+
2043
if (searchInstanceRef.current) {
2144
searchInstanceRef.current.destroy?.();
2245
searchInstanceRef.current = null;
2346
}
2447

25-
// Clear the container content
2648
searchButtonRef.current.innerHTML = '';
2749

28-
// Dynamic import to avoid SSR issues with solid-js
2950
Promise.all([
3051
import('meilisearch-docsearch'),
3152
import('meilisearch-docsearch/css')
@@ -129,6 +150,7 @@ function SearchBarContent() {
129150
});
130151

131152
return () => {
153+
document.removeEventListener('keydown', handleKeyDown, true);
132154
if (searchInstanceRef.current) {
133155
searchInstanceRef.current.destroy?.();
134156
searchInstanceRef.current = null;

0 commit comments

Comments
 (0)