Add a keyboard shortcut central registry for page views.
Review Request #10913 — Created Feb. 24, 2020 and updated — Latest diff uploaded
Created an object which can be a central registry for keyboard
shortcuts on the current page. This new objectkeyBindings
is
owned byRB.Pageview
. Subclasses ofRB.PageView
(e.g.,diffViewerPageView
anddataGridPageView
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 andhelp
(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."); }, ...