Skip to content

Commit 186c3ac

Browse files
committed
set electron minimum width
1 parent 11fe022 commit 186c3ac

File tree

1 file changed

+2
-169
lines changed

1 file changed

+2
-169
lines changed

main.cjs

Lines changed: 2 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ async function createMainWindow() {
8484
let windowOptions = {
8585
width: Math.min(1200, width),
8686
height: Math.min(800, height),
87+
minWidth: 1200,
88+
minHeight: 800,
8789
icon: iconPath,
8890
webPreferences: {
8991
nodeIntegration: false,
@@ -425,175 +427,6 @@ ipcMain.handle('get-version-info', async () => {
425427
return result;
426428
});
427429

428-
// function createMenuTemplate() {
429-
// const menuTemplate = [
430-
// {
431-
// label: "File",
432-
// submenu: [
433-
// {
434-
// label: "Open File",
435-
// accelerator: "CmdOrCtrl+O",
436-
// click: async () => {
437-
// const result = await dialog.showOpenDialog({
438-
// properties: ['openFile']
439-
// });
440-
// if (!result.canceled) {
441-
// try {
442-
// const filePath = result.filePaths[0];
443-
// const content = await fsPromises.readFile(filePath, 'utf-8');
444-
// mainWindow.webContents.send('file-opened', content);
445-
// } catch (err) {
446-
// console.error('Error reading file:', err);
447-
// }
448-
// }
449-
// }
450-
// },
451-
// { role: "reload" },
452-
// {
453-
// label: 'Exit',
454-
// accelerator: 'Ctrl+Q',
455-
// click: () => {
456-
// try {
457-
// // Save bounds for all open windows before quitting
458-
// BrowserWindow.getAllWindows().forEach(w => {
459-
// try {
460-
// if (w && !w.isDestroyed()) saveConfig(w);
461-
// } catch (e) {
462-
// console.error('Error saving window during Exit:', e);
463-
// }
464-
// });
465-
// } catch (e) {
466-
// console.error('Error during Exit save loop:', e);
467-
// } finally {
468-
// // Use app.quit() — let Electron close windows gracefully
469-
// app.quit();
470-
// }
471-
// }
472-
// },
473-
// ],
474-
// },
475-
// {
476-
// label: "Edit",
477-
// submenu: [
478-
// { role: "undo" },
479-
// { role: "redo" },
480-
// { type: "separator" },
481-
// { role: "cut" },
482-
// { role: "copy" },
483-
// { role: "paste" },
484-
// { role: "delete" },
485-
// { role: "selectall" },
486-
// ],
487-
// },
488-
// {
489-
// label: "View",
490-
// submenu: [
491-
// {
492-
// label: "Go Back",
493-
// accelerator: "CommandOrControl+B",
494-
// click: () => {
495-
// const focusedWindow = BrowserWindow.getFocusedWindow();
496-
// if (focusedWindow && focusedWindow.webContents.navigationHistory.canGoBack()) {
497-
// focusedWindow.webContents.navigationHistory.goBack();
498-
// }
499-
// },
500-
// },
501-
// { type: "separator" },
502-
// { role: "resetzoom" },
503-
// { role: "zoomin" },
504-
// { role: "zoomout" },
505-
// { type: "separator" },
506-
// {
507-
// label: "PreviewPanel",
508-
// submenu: [
509-
// {
510-
// label: "Increase LineHeight",
511-
// accelerator: "CommandOrControl+M",
512-
// click: () => {
513-
// mainWindow.webContents.send('update-preview-spacing', {
514-
// action: 'increase',
515-
// selector: '.preview-horizontal, .preview-parallel, .preview-horizontal-full'
516-
// });
517-
// },
518-
// },
519-
// {
520-
// label: "Decrease LineHeight",
521-
// accelerator: "CommandOrControl+L",
522-
// click: () => {
523-
// mainWindow.webContents.send('update-preview-spacing', {
524-
// action: 'decrease',
525-
// selector: '.preview-horizontal, .preview-parallel, .preview-horizontal-full'
526-
// });
527-
// },
528-
// },
529-
// ],
530-
// },
531-
// { role: "toggledevtools" },
532-
// ],
533-
// },
534-
// {
535-
// label: "Help",
536-
// submenu: [
537-
// {
538-
// label: 'Check for Updates',
539-
// click: () => {
540-
// const iconPath = path.join(__dirname, 'public', process.platform === 'win32' ? 'icon.ico' : 'icon.png');
541-
// releaseWindow = new BrowserWindow({
542-
// width: 1270,
543-
// height: 600,
544-
// modal: true,
545-
// icon: iconPath,
546-
// parent: mainWindow,
547-
// webPreferences: {
548-
// nodeIntegration: true,
549-
// contextIsolation: false,
550-
// },
551-
// });
552-
// releaseWindow.setMenuBarVisibility(false);
553-
// releaseWindow.loadFile(path.join(__dirname, 'release','release.html'));
554-
// releaseWindow.webContents.on('will-navigate', (event, url) => {
555-
// event.preventDefault();
556-
// openLinkInNewWindow(url);
557-
// });
558-
559-
// releaseWindow.webContents.setWindowOpenHandler(({ url }) => {
560-
// openLinkInNewWindow(url);
561-
// return { action: 'deny' };
562-
// });
563-
// },
564-
// },
565-
// { type: "separator" },
566-
// {
567-
// label: 'About',
568-
// click: () => {
569-
// const iconPath = path.join(__dirname, 'public', process.platform === 'win32' ? 'icon.ico' : 'icon.png');
570-
// const aboutWindow = new BrowserWindow({
571-
// width: 1270,
572-
// height: 860,
573-
// modal: true,
574-
// icon: iconPath,
575-
// parent: mainWindow,
576-
// webPreferences: {
577-
// nodeIntegration: true,
578-
// contextIsolation: false,
579-
// },
580-
// });
581-
// aboutWindow.setMenuBarVisibility(false);
582-
// aboutWindow.loadFile(path.join(__dirname, 'about','about.html'));
583-
// },
584-
// },
585-
// ],
586-
// }
587-
// ];
588-
589-
// return menuTemplate;
590-
// }
591-
592-
// function setupMenu() {
593-
// const menu = Menu.buildFromTemplate(createMenuTemplate());
594-
// Menu.setApplicationMenu(menu);
595-
// }
596-
597430
// App lifecycle management
598431
app.whenReady().then(async () => {
599432
await createMainWindow();

0 commit comments

Comments
 (0)