Description
Keyboard shortcuts are hardcoded in src/mdeck/controllers/inputs/keyboard.ts. There is no way to remap keys, add new bindings, or remove default ones without forking the library.
Proposed API
Accept an optional keyboardShortcuts map in createSlideshow() options, where keys are action names and values are key strings or arrays of key strings:
mdeck.createSlideshow({
keyboardShortcuts: {
gotoNextSlide: ['ArrowRight', 'ArrowDown', 'j', ' '],
gotoPreviousSlide: ['ArrowLeft', 'ArrowUp', 'k'],
togglePresenterMode: 'p',
toggleFullscreen: 'f',
}
});
Setting a shortcut to null or omitting it could disable that binding entirely.
Use cases
- Presentations controlled by a physical clicker with non-standard key codes
- Accessibility: remapping to keys reachable with one hand
- Avoiding conflicts with custom JavaScript on the page
- Adding Shift+Space as a "previous slide" shortcut (commonly requested by reveal.js users)
Ported from gnab/remark#684 and gnab/remark#687
Description
Keyboard shortcuts are hardcoded in
src/mdeck/controllers/inputs/keyboard.ts. There is no way to remap keys, add new bindings, or remove default ones without forking the library.Proposed API
Accept an optional
keyboardShortcutsmap increateSlideshow()options, where keys are action names and values are key strings or arrays of key strings:Setting a shortcut to
nullor omitting it could disable that binding entirely.Use cases
Ported from gnab/remark#684 and gnab/remark#687