fix: only set backgroundColor in default-app for default index.html (#28792)
This commit is contained in:
parent
7c32deb70f
commit
ae0de8ef9f
1 changed files with 3 additions and 3 deletions
|
@ -41,14 +41,14 @@ ipcMain.handle('bootstrap', (event) => {
|
||||||
return isTrustedSender(event.sender) ? electronPath : null;
|
return isTrustedSender(event.sender) ? electronPath : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
async function createWindow () {
|
async function createWindow (backgroundColor?: string) {
|
||||||
await app.whenReady();
|
await app.whenReady();
|
||||||
|
|
||||||
const options: Electron.BrowserWindowConstructorOptions = {
|
const options: Electron.BrowserWindowConstructorOptions = {
|
||||||
width: 960,
|
width: 960,
|
||||||
height: 620,
|
height: 620,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
backgroundColor: '#2f3241',
|
backgroundColor,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.resolve(__dirname, 'preload.js'),
|
preload: path.resolve(__dirname, 'preload.js'),
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
|
@ -95,7 +95,7 @@ export const loadURL = async (appUrl: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const loadFile = async (appPath: string) => {
|
export const loadFile = async (appPath: string) => {
|
||||||
mainWindow = await createWindow();
|
mainWindow = await createWindow(appPath === 'index.html' ? '#2f3241' : undefined);
|
||||||
mainWindow.loadFile(appPath);
|
mainWindow.loadFile(appPath);
|
||||||
mainWindow.focus();
|
mainWindow.focus();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue