mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Make <a target="_blank"> open window by default
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
EventEmitter = require('events').EventEmitter
|
||||
IDWeakMap = require 'id-weak-map'
|
||||
app = require 'app'
|
||||
ipc = require 'ipc'
|
||||
wrapWebContents = require('web-contents').wrap
|
||||
|
||||
BrowserWindow = process.atomBinding('window').BrowserWindow
|
||||
@@ -23,9 +24,11 @@ BrowserWindow::_init = ->
|
||||
value: BrowserWindow.windows.add(this)
|
||||
enumerable: true
|
||||
|
||||
# Route the "new-window" event to webContents.
|
||||
@on 'new-window', (args...) =>
|
||||
@webContents?.emit 'new-window', args...
|
||||
# Make new windows requested by links behave like "window.open"
|
||||
@on 'new-window', (event, url, frameName) =>
|
||||
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
|
||||
# could be iterating windows before GC happened.
|
||||
|
||||
Reference in New Issue
Block a user