Revert "Honor created() function for an item in a submenu."

This reverts commit 9917ed39aa.

Sorry, apparently I don't know how to use Git anymore.
I'm just trying to put this up for review and it went straight
to master instead.
This commit is contained in:
Michael Bolin 2016-01-18 16:36:49 -08:00
parent 9917ed39aa
commit 04b100fab8

View File

@ -136,9 +136,12 @@ class ContextMenuManager
for itemSet in matchingItemSets
for item in itemSet.items
itemForEvent = @cloneItemForEvent(item, event)
if itemForEvent
MenuHelpers.merge(currentTargetItems, itemForEvent, itemSet.specificity)
continue if item.devMode and not @devMode
item = Object.create(item)
if typeof item.shouldDisplay is 'function'
continue unless item.shouldDisplay(event)
item.created?(event)
MenuHelpers.merge(currentTargetItems, item, itemSet.specificity)
for item in currentTargetItems
MenuHelpers.merge(template, item, false)
@ -147,19 +150,6 @@ class ContextMenuManager
template
# Returns an object compatible with `::add()` or `null`.
cloneItemForEvent: (item, event) ->
return null if item.devMode and not @devMode
item = Object.create(item)
if typeof item.shouldDisplay is 'function'
return null unless item.shouldDisplay(event)
item.created?(event)
if Array.isArray(item.submenu)
item.submenu = item.submenu
.map((item) => @cloneItemForEvent(item, event))
.filter((item) -> item isnt null)
return item
convertLegacyItemsBySelector: (legacyItemsBySelector, devMode) ->
itemsBySelector = {}