Skip to content

Commit

Permalink
Merge pull request hakimel#2326 from earboxer/2313-navigation-mode-sh…
Browse files Browse the repository at this point in the history
…ortcuts-table

Allow Navigation Mode setting to change the shortcuts table
  • Loading branch information
hakimel authored Apr 1, 2019
2 parents 29ea072 + bb4eeb6 commit 94cbfcb
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,20 +374,8 @@
threshold: 40
},

// Holds information about the keyboard shortcuts
keyboardShortcuts = {
'N , SPACE': 'Next slide',
'P': 'Previous slide',
'← , H': 'Navigate left',
'→ , L': 'Navigate right',
'↑ , K': 'Navigate up',
'↓ , J': 'Navigate down',
'Home , ⌘/CTRL ←': 'First slide',
'End , ⌘/CTRL →': 'Last slide',
'B , .': 'Pause',
'F': 'Fullscreen',
'ESC, O': 'Slide overview'
},
// Holds information about the keyboard shortcuts (filled in on configuration).
keyboardShortcuts = {},

// Holds custom key code mappings
registeredKeyBindings = {};
Expand Down Expand Up @@ -1444,6 +1432,25 @@
dom.wrapper.removeAttribute( 'data-navigation-mode' );
}


if( config.navigationMode === 'linear' ) {
keyboardShortcuts['N , SPACE , → , L , ↓ , J'] = 'Next slide';
keyboardShortcuts['P , ← , H , ↑ , K'] = 'Previous slide';
}
else {
keyboardShortcuts['N , SPACE'] = 'Next slide';
keyboardShortcuts['P'] = 'Previous slide';
keyboardShortcuts['← , H'] = 'Navigate left';
keyboardShortcuts['→ , L'] = 'Navigate right';
keyboardShortcuts['↑ , K'] = 'Navigate up';
keyboardShortcuts['↓ , J'] = 'Navigate down';
}
keyboardShortcuts['Home , ⌘/CTRL ←'] = 'First slide';
keyboardShortcuts['End , ⌘/CTRL →'] = 'Last slide';
keyboardShortcuts['B , .'] = 'Pause';
keyboardShortcuts['F'] = 'Fullscreen';
keyboardShortcuts['ESC, O'] = 'Slide overview';

sync();

}
Expand Down

0 comments on commit 94cbfcb

Please sign in to comment.