diff --git a/spec/atom/window-spec.coffee b/spec/atom/window-spec.coffee index f1e8ece3f..3a8fac668 100644 --- a/spec/atom/window-spec.coffee +++ b/spec/atom/window-spec.coffee @@ -46,8 +46,3 @@ describe "Window", -> it "adds a Save item to the main menu after startup", -> expect(OSX.NSApp.mainMenu.itemWithTitle('File').submenu.itemWithTitle('Save')).not.toBeNull() - describe 'meta+s', -> - it 'saves the buffer', -> - spyOn(window.rootView.editor, 'save') - window.keydown 'meta+s' - expect(window.rootView.editor.save).toHaveBeenCalled() diff --git a/src/atom/root-view.coffee b/src/atom/root-view.coffee index b5c8c9b18..d59927098 100644 --- a/src/atom/root-view.coffee +++ b/src/atom/root-view.coffee @@ -20,6 +20,11 @@ class RootView extends Template @subview 'editor', Editor.build() viewProperties: + initialize: -> + @bindKey 'meta+s', => @editor.save() + @bindKey 'meta+w', => window.close() + @bindKey 'meta+t', => @toggleFileFinder() + addPane: (view) -> pane = $('
') pane.append(view) diff --git a/src/atom/window.coffee b/src/atom/window.coffee index 32198e411..3c194715b 100644 --- a/src/atom/window.coffee +++ b/src/atom/window.coffee @@ -16,7 +16,6 @@ windowAdditions = @rootView = RootView.attach() @rootView.editor.open $atomController.url?.toString() @registerEventHandlers() - @bindKeys() @bindMenuItems() $(window).focus() @@ -24,12 +23,6 @@ windowAdditions = @rootView.remove() $(window).unbind('focus') $(window).unbind('blur') - $(window).unbind('keydown') - - bindKeys: -> - $(document).bindKey 'meta+s', => @rootView.editor.save() - $(document).bindKey 'meta+w', => @close() - $(document).bindKey 'meta+t', => @rootView.toggleFileFinder() bindMenuItems: -> @bindMenuItem "File > Save", "meta+s", => @rootView.editor.save() @@ -57,3 +50,4 @@ windowAdditions = for key, value of windowAdditions console.warn "DOMWindow already has a key named `#{key}`" if window[key] window[key] = value +