mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Menu Items only show keyBindings that match the selector "body"
This commit is contained in:
committed by
Corey Johnson & Nathan Sobo
parent
477ac1768b
commit
0c542d2317
@@ -1,6 +1,4 @@
|
||||
'body':
|
||||
'meta-alt-ctrl-s': 'application:run-specs'
|
||||
'meta-,': 'application:show-settings'
|
||||
'meta-q': 'application:quit'
|
||||
'meta-h': 'application:hide'
|
||||
'meta-H': 'application:hide-other-applications'
|
||||
@@ -9,7 +7,9 @@
|
||||
'meta-o': 'application:open'
|
||||
'meta-O': 'application:open-dev'
|
||||
'meta-m': 'application:minimize'
|
||||
'meta-,': 'application:show-settings'
|
||||
'alt-meta-ctrl-m': 'application:zoom'
|
||||
'meta-alt-ctrl-s': 'application:run-specs'
|
||||
|
||||
'meta-s': 'core:save'
|
||||
'meta-S': 'core:save-as'
|
||||
|
||||
@@ -163,10 +163,12 @@ class Keymap
|
||||
|
||||
[modifiers..., key].join('-')
|
||||
|
||||
toObject: ->
|
||||
toObject: (selector)->
|
||||
body = $('body')
|
||||
keyBindingsForCommands = {}
|
||||
for bindingSet in @bindingSets
|
||||
for keystroke, command of bindingSet.commandsByKeystrokes
|
||||
continue unless selector? and body.is(bindingSet.selector)
|
||||
keyBindingsForCommands[command] ?= []
|
||||
keyBindingsForCommands[command].push keystroke
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ window.startEditorWindow = ->
|
||||
atom.activatePackages()
|
||||
keymap.loadUserKeymaps()
|
||||
atom.requireUserInitScript()
|
||||
ipc.sendChannel 'keymap-loaded', keymap.toObject()
|
||||
ipc.sendChannel 'keymap-loaded', keymap.toObject('body')
|
||||
$(window).on 'unload', -> unloadEditorWindow(); false
|
||||
atom.show()
|
||||
atom.focus()
|
||||
|
||||
Reference in New Issue
Block a user