mirror of
https://github.com/atom/atom.git
synced 2026-02-17 10:01:25 -05:00
Open http/https links in an external browser
Listen for all links being clicked and open any http/https hrefs by spawning a call to the 'open' command. Closes #531
This commit is contained in:
@@ -27,6 +27,15 @@ window.setUpEnvironment = ->
|
||||
window.pasteboard = new Pasteboard
|
||||
window.keymap = new Keymap()
|
||||
$(document).on 'keydown', keymap.handleKeyEvent
|
||||
|
||||
$(document).on 'click', 'a', (e) ->
|
||||
location = $(e.target).attr('href')
|
||||
return unless location or location[0] is '#'
|
||||
|
||||
if location.indexOf('https://') is 0 or location.indexOf('http://') is 0
|
||||
require('child_process').spawn('open', [location]) if location
|
||||
false
|
||||
|
||||
keymap.bindDefaultKeys()
|
||||
|
||||
requireStylesheet 'atom'
|
||||
|
||||
Reference in New Issue
Block a user