Make the help visible in all the themes of mdbook

Also handle the ? key with or without shift being pressed.
This commit is contained in:
Gabor Szabo 2025-04-02 18:29:59 +03:00 committed by Eric Huss
parent 4573f4d882
commit 2b455fcd34
2 changed files with 16 additions and 7 deletions

View file

@ -288,6 +288,7 @@ sup {
right: 0;
bottom: 0;
background-color: rgba(225,225,225,1);
color: black;
z-index: 2;
cursor: pointer;
border-width: 3px;
@ -297,6 +298,12 @@ sup {
padding: 10px;
}
#help-overlay kbd {
border-width: 1px;
border-color: black;
border-style: solid;
background-color: white;
}
#help-title {
text-align: center;
}

View file

@ -668,14 +668,16 @@ aria-label="Show hidden lines"></button>';
document.getElementById("help-overlay").style.display = "none";
}
if (e.shiftKey) {
switch (e.key) {
case '?':
e.preventDefault();
showHelp();
break;
}
// Usually needs the Shift key to be pressed
switch (e.key) {
case '?':
e.preventDefault();
showHelp();
break;
}
// Rest of the keys are only active when the Shift key is not pressed
if (e.shiftKey) {
return;
}