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 when 71
@trigger 'altG' @trigger 'altG'
false false
when 82
@trigger 'altR'
false
handleKeypressEvent: (event) -> handleKeypressEvent: (event) ->
if event.which is 63 and not event.target.value if event.which is 63 and not event.target.value

@ -77,6 +77,9 @@ app.templates.helpPage = """
</dl> </dl>
<h3 class="_shortcuts-title">Misc</h3> <h3 class="_shortcuts-title">Misc</h3>
<dl class="_shortcuts-dl"> <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"> <dt class="_shortcuts-dt">
<code class="_shortcut-code">Alt + g</code> <code class="_shortcut-code">Alt + g</code>
<dd class="_shortcuts-dd">Search on Google <dd class="_shortcuts-dd">Search on Google

@ -25,7 +25,8 @@ newsItem = (date, news) ->
app.news = [ app.news = [
[ 1389484800000, # January 12, 2013 [ 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 1386979200000, # December 14, 2013
""" New <a href="/postgresql/">PostgreSQL</a> documentation """ """ New <a href="/postgresql/">PostgreSQL</a> documentation """

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

Loading…
Cancel
Save