Add a keyboard shortcut central registry for page views.

Review Request #10913 — Created Feb. 24, 2020 and updated — Latest diff uploaded

Information

Review Board
master

Reviewers

Created an object which can be a central registry for keyboard
shortcuts on the current page. This new object keyBindings is
owned by RB.Pageview. Subclasses of RB.PageView (e.g., diffViewerPageView
and dataGridPageView can extend this new object to have their own
keyboard shortcuts.

Each key set can map to two things: callback mapping to a callback
function and help (temporary mapping to a str text, can be a foundation
of future features).

The old keyboard shortcuts on diffViewerPageView are still working.

Tested on Chrome and Firefox.

Tested in dataGridPageView by adding this dummy code segment:

...

keyBindings: _.extend({
    'a': {
        callback: 'testAlert',
    }
}, RB.PageView.prototype.keyBindings),

testAlert() {
    alert("This is a test alert.");
},
...

Diff Revision 4

This is not the most recent revision of the diff. The latest diff is revision 5. See what's changed.

orig
1
2
3
4
5

Commits

First Last Summary ID Author
Add a keyboard shortcut central registry for page views.
3dec5902e36f9da5eec25993418c4e88c667f80a Jay
Remove one extra space.
3d82ba3525b1f48711372952ec94389951542d70 Jay
Add missing semicolon.
5acf1f77a465eb609535fade44747d64bbd5e00e Jay
Remove console.log and change some wording.
e63693dc2281dd08feaf4957f3ab57717c50a342 Jay
Use extend instead of overwriting.
699106b138a1736c497fdb1ed23c5cbdd20d5605 Jay
reviewboard/static/rb/js/pages/views/basePageView.es6.js
reviewboard/static/rb/js/pages/views/diffViewerPageView.es6.js
reviewboard/static/rb/js/utils/keyBindingUtils.es6.js
Loading...