Add keyboard shortcut for revealing the current page in the sidebar

pull/47/head
Thibaut 11 years ago
parent d672b1c5e6
commit ed3c1dcb28

@ -104,6 +104,9 @@ class app.Shortcuts
when 71
@trigger 'altG'
false
when 82
@trigger 'altR'
false
handleKeypressEvent: (event) ->
if event.which is 63 and not event.target.value

@ -77,6 +77,9 @@ app.templates.helpPage = """
</dl>
<h3 class="_shortcuts-title">Misc</h3>
<dl class="_shortcuts-dl">
<dt class="_shortcuts-dt">
<code class="_shortcut-code">Alt + r</code>
<dd class="_shortcuts-dd">Reveal current page in sidebar
<dt class="_shortcuts-dt">
<code class="_shortcut-code">Alt + g</code>
<dd class="_shortcuts-dd">Search on Google

@ -25,7 +25,8 @@ newsItem = (date, news) ->
app.news = [
[ 1389484800000, # January 12, 2013
""" Added <code class="_label">Alt + g</code> shortcut for searching on Google. """
""" Added <code class="_label">Alt + g</code> shortcut for searching on Google. """,
""" Added <code class="_label">Alt + r</code> shortcut for revealing the current page in the sidebar. """
], [
1386979200000, # December 14, 2013
""" New <a href="/postgresql/">PostgreSQL</a> documentation """

@ -6,6 +6,7 @@ class app.views.Sidebar extends app.View
click: 'onClick'
@shortcuts:
altR: 'onAltR'
escape: 'onEscape'
init: ->
@ -85,6 +86,10 @@ class app.views.Sidebar extends app.View
@showDocList() unless $.hasChild @el, event.target
return
onAltR: =>
@showDocList true
return
onEscape: =>
@showDocList true
@scrollToTop()

Loading…
Cancel
Save