feat(navigation): add support for vi bindings

- navigation to previous is `h` key similar to left arrow
 - navigation to next is `l` key similar to right arrow
This commit is contained in:
Sven Assmann 2020-12-22 00:38:13 +01:00
parent cf2459f730
commit 8ab5ac892e
1 changed files with 2 additions and 0 deletions

View File

@ -539,6 +539,7 @@ function playground_text(playground) {
switch (e.key) { switch (e.key) {
case 'ArrowRight': case 'ArrowRight':
case 'l':
e.preventDefault(); e.preventDefault();
var nextButton = document.querySelector('.nav-chapters.next'); var nextButton = document.querySelector('.nav-chapters.next');
if (nextButton) { if (nextButton) {
@ -546,6 +547,7 @@ function playground_text(playground) {
} }
break; break;
case 'ArrowLeft': case 'ArrowLeft':
case 'h':
e.preventDefault(); e.preventDefault();
var previousButton = document.querySelector('.nav-chapters.previous'); var previousButton = document.querySelector('.nav-chapters.previous');
if (previousButton) { if (previousButton) {