Make <a target="_blank"> open window by default
This commit is contained in:
parent
f44be28309
commit
cc9ff77dd2
1 changed files with 6 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
EventEmitter = require('events').EventEmitter
|
EventEmitter = require('events').EventEmitter
|
||||||
IDWeakMap = require 'id-weak-map'
|
IDWeakMap = require 'id-weak-map'
|
||||||
app = require 'app'
|
app = require 'app'
|
||||||
|
ipc = require 'ipc'
|
||||||
wrapWebContents = require('web-contents').wrap
|
wrapWebContents = require('web-contents').wrap
|
||||||
|
|
||||||
BrowserWindow = process.atomBinding('window').BrowserWindow
|
BrowserWindow = process.atomBinding('window').BrowserWindow
|
||||||
|
@ -23,9 +24,11 @@ BrowserWindow::_init = ->
|
||||||
value: BrowserWindow.windows.add(this)
|
value: BrowserWindow.windows.add(this)
|
||||||
enumerable: true
|
enumerable: true
|
||||||
|
|
||||||
# Route the "new-window" event to webContents.
|
# Make new windows requested by links behave like "window.open"
|
||||||
@on 'new-window', (args...) =>
|
@on 'new-window', (event, url, frameName) =>
|
||||||
@webContents?.emit 'new-window', args...
|
event.sender = @webContents
|
||||||
|
options = show: true, width: 800, height: 600
|
||||||
|
ipc.emit 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', event, url, frameName, options
|
||||||
|
|
||||||
# Remove the window from weak map immediately when it's destroyed, since we
|
# Remove the window from weak map immediately when it's destroyed, since we
|
||||||
# could be iterating windows before GC happened.
|
# could be iterating windows before GC happened.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue