diff --git a/spec/app/window-spec.coffee b/spec/app/window-spec.coffee index e39f451b9..12c629b77 100644 --- a/spec/app/window-spec.coffee +++ b/spec/app/window-spec.coffee @@ -7,7 +7,7 @@ describe "Window", -> beforeEach -> spyOn(atom, 'getPathToOpen').andReturn(project.getPath()) - window.handleWindowEvents() + window.handleEvents() window.deserializeEditorWindow() projectPath = project.getPath() diff --git a/src/app/window.coffee b/src/app/window.coffee index 37febf467..7a58f522c 100644 --- a/src/app/window.coffee +++ b/src/app/window.coffee @@ -28,15 +28,6 @@ window.setUpEnvironment = -> window.keymap = new Keymap() $(document).on 'keydown', keymap.handleKeyEvent - $(document).on 'click', 'a', (e) -> - location = $(e.target).attr('href') - return unless location - return if location[0] is '#' - - if location.indexOf('https://') is 0 or location.indexOf('http://') is 0 - require('child_process').spawn('open', [location]) - false - keymap.bindDefaultKeys() requireStylesheet 'atom' @@ -53,7 +44,7 @@ window.startEditorWindow = -> console.warn "Failed to install `atom` binary" atom.windowMode = 'editor' - handleWindowEvents() + handleEvents() handleDragDrop() config.load() keymap.loadBundledKeymaps() @@ -68,7 +59,7 @@ window.startEditorWindow = -> window.startConfigWindow = -> atom.windowMode = 'config' - handleWindowEvents() + handleEvents() config.load() keymap.loadBundledKeymaps() atom.loadThemes() @@ -120,13 +111,22 @@ window.unloadConfigWindow = -> window.configView = null $(window).off('focus blur before') -window.handleWindowEvents = -> +window.handleEvents = -> $(window).command 'window:toggle-full-screen', => atom.toggleFullScreen() $(window).on 'focus', -> $("body").removeClass('is-blurred') $(window).on 'blur', -> $("body").addClass('is-blurred') $(window).command 'window:close', => confirmClose() $(window).command 'window:reload', => reload() + $(document).on 'click', 'a', (e) -> + location = $(e.target).attr('href') + return unless location + return if location[0] is '#' + + if location.indexOf('https://') is 0 or location.indexOf('http://') is 0 + require('child_process').spawn('open', [location]) + false + window.handleDragDrop = -> $(document).on 'dragover', (e) -> e.preventDefault()