Adds keyboard bindings and associated help menu for selecting reminder type in bookmark modal, and pressing Enter to save.
Introduce the following APIs for `KeyboardShortcuts`:
* `pause` - Uses the provided array of combinations and unbinds them using `Mousetrap`.
* `unpause` - Uses the provided combinations and rebinds them to their default shortcuts listed in `KeyboardShortcuts`.
* `addBindings` - Adds the array of keyboard shortcut bindings and calls the provided callback when a binding is fired with Mousetrap.
* `unbind` - Takes an object literal of a binding map and unbinds all of them e.g. `{ enter: { handler: saveAndClose" } };`
12 lines
260 B
JavaScript
12 lines
260 B
JavaScript
/*global Mousetrap:true*/
|
|
import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
|
|
|
|
export default {
|
|
name: "keyboard-shortcuts",
|
|
|
|
initialize(container) {
|
|
KeyboardShortcuts.init(Mousetrap, container);
|
|
KeyboardShortcuts.bindEvents();
|
|
}
|
|
};
|