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

View file

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