Open links in background when ⌘ key is pressed (#1637)

When you hold down the meta key (⌘), and click on a link in a message,
the target application will not activate, so N1 will stay in the
foreground.
Electron only supports this for OS X
This commit is contained in:
Koen Punt 2016-04-13 03:11:27 +02:00 committed by Ben Gotow
parent 5fd8faa82c
commit 08d18765d7
3 changed files with 4 additions and 4 deletions

View file

@ -11,7 +11,7 @@
"bugs": {
"url": "https://github.com/nylas/N1/issues"
},
"electronVersion": "0.36.7",
"electronVersion": "0.36.9",
"dependencies": {
"async": "^0.9",
"atom-keymap": "^6.1.1",

View file

@ -151,7 +151,7 @@ class EventedIFrame extends React.Component
target.setAttribute('href', "http://#{rawHref}")
e.preventDefault()
NylasEnv.windowEventHandler.openLink(target: target)
NylasEnv.windowEventHandler.openLink(target: target, metaKey: e.metaKey)
_isBlacklistedHref: (href) ->
return (new RegExp(/^file:/i)).test(href)

View file

@ -173,7 +173,7 @@ class WindowEventHandler
event.preventDefault()
event.stopPropagation()
openLink: ({href, target, currentTarget}) ->
openLink: ({href, target, currentTarget, metaKey}) ->
if not href
href = target?.getAttribute('href') or currentTarget?.getAttribute('href')
@ -191,7 +191,7 @@ class WindowEventHandler
href = encodeURI(decodeURI(href))
remote.getGlobal('application').openUrl(href)
else if schema in ['http:', 'https:', 'tel:']
shell.openExternal(href)
shell.openExternal(href, activate: !metaKey)
return