diff --git a/ElectronNET.API/Entities/BrowserWindowOptions.cs b/ElectronNET.API/Entities/BrowserWindowOptions.cs index 30ca010..2a860d2 100644 --- a/ElectronNET.API/Entities/BrowserWindowOptions.cs +++ b/ElectronNET.API/Entities/BrowserWindowOptions.cs @@ -155,8 +155,8 @@ namespace ElectronNET.API.Entities public bool? Frame { get; set; } = true; /// - /// Whether this is a modal window. This only works when the window is a child - /// window.Default is false. + /// Whether this is a modal window. This only works when is + /// also specified. Default is false. /// public bool? Modal { get; set; } @@ -281,6 +281,12 @@ namespace ElectronNET.API.Entities public string ProxyCredentials { get; set; } + /// + /// The window to use as the created window's parent. + /// + [DefaultValue(null)] + public BrowserWindow Parent { get; set; } + /// /// Set a custom position for the traffic light buttons in frameless windows. /// diff --git a/ElectronNET.Host/api/browserWindows.js b/ElectronNET.Host/api/browserWindows.js index 4b7f7fc..10b7a51 100644 --- a/ElectronNET.Host/api/browserWindows.js +++ b/ElectronNET.Host/api/browserWindows.js @@ -187,6 +187,9 @@ module.exports = (socket, app, firstTime) => { else if (!options.webPreferences) { options = { ...options, webPreferences: { nodeIntegration: true, contextIsolation: false } }; } + if (options.parent) { + options.parent = electron_1.BrowserWindow.fromId(options.parent.id); + } if (options.x && options.y && options.x == 0 && options.y == 0) { delete options.x; delete options.y; diff --git a/ElectronNET.Host/api/browserWindows.ts b/ElectronNET.Host/api/browserWindows.ts index 2cb2e2f..4a4b7ab 100644 --- a/ElectronNET.Host/api/browserWindows.ts +++ b/ElectronNET.Host/api/browserWindows.ts @@ -222,6 +222,10 @@ export = (socket: Socket, app: Electron.App, firstTime: boolean) => { options = {...options, webPreferences: {nodeIntegration: true, contextIsolation: false}}; } + if (options.parent) { + options.parent = BrowserWindow.fromId(options.parent.id); + } + if (options.x && options.y && options.x == 0 && options.y == 0) { delete options.x; delete options.y;