mirror of
https://github.com/atom/atom.git
synced 2026-01-29 16:58:20 -05:00
Load menus from packages
This commit is contained in:
@@ -92,6 +92,7 @@ class AtomPackage extends Package
|
||||
activateResources: ->
|
||||
keymap.add(keymapPath, map) for [keymapPath, map] in @keymaps
|
||||
atom.contextMenu.add(menuPath, map['context-menu']) for [menuPath, map] in @menus
|
||||
atom.menu.add(map.menu) for [menuPath, map] in @menus when map.menu
|
||||
syntax.addGrammar(grammar) for grammar in @grammars
|
||||
for [scopedPropertiesPath, selector, properties] in @scopedProperties
|
||||
syntax.addProperties(scopedPropertiesPath, selector, properties)
|
||||
|
||||
@@ -24,8 +24,8 @@ class MenuManager
|
||||
# https://github.com/atom/atom-shell/blob/master/docs/api/browser/menu.md
|
||||
#
|
||||
# Returns nothing.
|
||||
add: (item) ->
|
||||
@merge(@template, item)
|
||||
add: (items) ->
|
||||
@merge(@template, item) for item in items
|
||||
|
||||
# Public: Refreshes the currently visible menu.
|
||||
update: ->
|
||||
@@ -36,7 +36,7 @@ class MenuManager
|
||||
menuPaths = fsUtils.listSync(atom.config.bundledMenusDirPath, ['cson', 'json'])
|
||||
for menuPath in menuPaths
|
||||
data = CSON.readFileSync(menuPath)
|
||||
@add(item) for item in data.menu
|
||||
@add(data.menu)
|
||||
|
||||
# Private: Merges an item in a menu aware way such that new items are always
|
||||
# appended to the bottom.
|
||||
|
||||
Reference in New Issue
Block a user