Only show events w/ descriptions in EventPalette

Also, auto-generate human readable event name in editor. This is a good example of how we could do this automatically for some kind of `onCommand`, `command`, `onInteractiveEvent` method that combines the event name, documentation string, and handler in one shot.
This commit is contained in:
Corey Johnson & Nathan Sobo
2012-10-19 11:24:40 -06:00
parent 2b8c946a65
commit de3bbce29f
8 changed files with 61 additions and 32 deletions

View File

@@ -51,3 +51,14 @@ _.mixin
# even though only some strictly require it when inside of []
regex = RegExp('[' + specials.join('\\') + ']', 'g')
string.replace(regex, "\\$&");
humanizeEventName: (eventName) ->
if /:/.test(eventName)
[namespace, name] = eventName.split(':')
return "#{@humanizeEventName(namespace)}: #{@humanizeEventName(name)}"
words = eventName.split('-')
words.map(_.capitalize).join(' ')
capitalize: (word) ->
word[0].toUpperCase() + word[1..]