Include commands registered via jQuery in CommandRegistry::findCommands

This commit is contained in:
Nathan Sobo
2014-09-11 14:16:34 -06:00
parent 8b7b946429
commit fb6a184b0e

View File

@@ -1,6 +1,7 @@
{Disposable, CompositeDisposable} = require 'event-kit'
{specificity} = require 'clear-cut'
_ = require 'underscore-plus'
{$} = require './space-pen-extensions'
SequenceCount = 0
SpecificityCache = {}
@@ -70,6 +71,7 @@ class CommandRegistry
findCommands: ({target}) ->
commands = []
target = @rootNode unless @rootNode.contains(target)
currentTarget = target
loop
for commandName, listeners of @listenersByCommandName
@@ -82,6 +84,12 @@ class CommandRegistry
break if currentTarget is @rootNode
currentTarget = currentTarget.parentNode
for name, displayName of $(target).events() when displayName
commands.push({name, displayName, jQuery: true})
for name, displayName of $(window).events() when displayName
commands.push({name, displayName, jQuery: true})
commands
clear: ->