Skip to content

[Doc] cmd+k #19957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/mkdocs/javascript/shortcuts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
document.addEventListener('keydown', function (event) {
if (event.key.lower() === '/') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be toLowerCase()

// we actually don't want to bind this key on docs given that it uses builtin mkdocs search.
event.preventDefault();
} else if ((event.altKey || event.metaKey) && event.key.lower() === 'k') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be toLowerCase()
@DarkLight1337 i test work in mac and or win

event.preventDefault();
const query = document.querySelector('[data-md-component="search-query"]');
if (query) {
query.focus();
query.select();
}
};
});
3 changes: 2 additions & 1 deletion mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ theme:
name: Switch to light mode
# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
scheme: default
primary: white
toggle:
icon: material/brightness-7
Expand Down Expand Up @@ -127,6 +127,7 @@ extra_javascript:
- mkdocs/javascript/run_llm_widget.js
- https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML
- mkdocs/javascript/edit_and_feedback.js
- mkdocs/javascript/shortcuts.js

# Makes the url format end in .html rather than act as a dir
# So index.md generates as index.html and is available under URL /index.html
Expand Down