Bind link click handler in window.handleEvents()

This commit is contained in:
Kevin Sawicki 2013-05-01 22:18:39 -07:00
parent c2118a8cb9
commit ee621bcace
2 changed files with 13 additions and 13 deletions

View File

@ -7,7 +7,7 @@ describe "Window", ->
beforeEach ->
spyOn(atom, 'getPathToOpen').andReturn(project.getPath())
window.handleWindowEvents()
window.handleEvents()
window.deserializeEditorWindow()
projectPath = project.getPath()

View File

@ -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()