This commit is contained in:
theolivenbaum
2022-06-09 10:12:15 +02:00
parent 4906babd78
commit 68c9e80417
3 changed files with 15 additions and 2 deletions

View File

@@ -155,8 +155,8 @@ namespace ElectronNET.API.Entities
public bool? Frame { get; set; } = true;
/// <summary>
/// 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 <see cref="Parent"/> is
/// also specified. Default is false.
/// </summary>
public bool? Modal { get; set; }
@@ -281,6 +281,12 @@ namespace ElectronNET.API.Entities
public string ProxyCredentials { get; set; }
/// <summary>
/// The window to use as the created window's parent.
/// </summary>
[DefaultValue(null)]
public BrowserWindow Parent { get; set; }
/// <summary>
/// Set a custom position for the traffic light buttons in frameless windows.
/// </summary>

View File

@@ -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;

View File

@@ -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;