diff --git a/src/app/root-view.coffee b/src/app/root-view.coffee index 3f98d2d0f..6a8162eb5 100644 --- a/src/app/root-view.coffee +++ b/src/app/root-view.coffee @@ -74,11 +74,11 @@ class RootView extends View @project.setPath(path) unless @project.getRootDirectory() @setTitle(path) - @on 'root-view:increase-font-size', => @setFontSize(@getFontSize() + 1) - @on 'root-view:decrease-font-size', => @setFontSize(@getFontSize() - 1) - @on 'root-view:focus-next-pane', => @focusNextPane() - @on 'root-view:save-all', => @saveAll() - @on 'root-view:toggle-invisibles', => @setShowInvisibles(not @showInvisibles) + @command 'root-view:increase-font-size', => @setFontSize(@getFontSize() + 1) + @command 'root-view:decrease-font-size', => @setFontSize(@getFontSize() - 1) + @command 'root-view:focus-next-pane', => @focusNextPane() + @command 'root-view:save-all', => @saveAll() + @command 'root-view:toggle-invisibles', => @setShowInvisibles(not @showInvisibles) afterAttach: (onDom) -> @focus() if onDom diff --git a/src/stdlib/jquery-extensions.coffee b/src/stdlib/jquery-extensions.coffee index 928e15c0a..8e0259b57 100644 --- a/src/stdlib/jquery-extensions.coffee +++ b/src/stdlib/jquery-extensions.coffee @@ -65,3 +65,10 @@ $.fn.events = -> _.extend(@parent().events(), events) else events + +$.fn.command = (args...) -> + eventName = args[0] + documentation = {} + documentation[eventName] = _.humanizeEventName(eventName) + @document(documentation) + @on(args...)