@@ -250,174 +250,174 @@ function setupIPCHandlers() {
250250 } ) ;
251251}
252252
253- function createMenuTemplate ( ) {
254- const menuTemplate = [
255- {
256- label : "File" ,
257- submenu : [
258- {
259- label : "Open File" ,
260- accelerator : "CmdOrCtrl+O" ,
261- click : async ( ) => {
262- const result = await dialog . showOpenDialog ( {
263- properties : [ 'openFile' ]
264- } ) ;
265- if ( ! result . canceled ) {
266- try {
267- const filePath = result . filePaths [ 0 ] ;
268- const content = await fsPromises . readFile ( filePath , 'utf-8' ) ;
269- mainWindow . webContents . send ( 'file-opened' , content ) ;
270- } catch ( err ) {
271- console . error ( 'Error reading file:' , err ) ;
272- }
273- }
274- }
275- } ,
276- { role : "reload" } ,
277- {
278- label : 'Exit' ,
279- accelerator : 'Ctrl+Q' ,
280- click : ( ) => {
281- try {
282- // Save bounds for all open windows before quitting
283- BrowserWindow . getAllWindows ( ) . forEach ( w => {
284- try {
285- if ( w && ! w . isDestroyed ( ) ) saveConfig ( w ) ;
286- } catch ( e ) {
287- console . error ( 'Error saving window during Exit:' , e ) ;
288- }
289- } ) ;
290- } catch ( e ) {
291- console . error ( 'Error during Exit save loop:' , e ) ;
292- } finally {
293- // Use app.quit() — let Electron close windows gracefully
294- app . quit ( ) ;
295- }
296- }
297- } ,
298- ] ,
299- } ,
300- {
301- label : "Edit" ,
302- submenu : [
303- { role : "undo" } ,
304- { role : "redo" } ,
305- { type : "separator" } ,
306- { role : "cut" } ,
307- { role : "copy" } ,
308- { role : "paste" } ,
309- { role : "delete" } ,
310- { role : "selectall" } ,
311- ] ,
312- } ,
313- {
314- label : "View" ,
315- submenu : [
316- {
317- label : "Go Back" ,
318- accelerator : "CommandOrControl+B" ,
319- click : ( ) => {
320- const focusedWindow = BrowserWindow . getFocusedWindow ( ) ;
321- if ( focusedWindow && focusedWindow . webContents . navigationHistory . canGoBack ( ) ) {
322- focusedWindow . webContents . navigationHistory . goBack ( ) ;
323- }
324- } ,
325- } ,
326- { type : "separator" } ,
327- { role : "resetzoom" } ,
328- { role : "zoomin" } ,
329- { role : "zoomout" } ,
330- { type : "separator" } ,
331- {
332- label : "PreviewPanel" ,
333- submenu : [
334- {
335- label : "Increase LineHeight" ,
336- accelerator : "CommandOrControl+M" ,
337- click : ( ) => {
338- mainWindow . webContents . send ( 'update-preview-spacing' , {
339- action : 'increase' ,
340- selector : '.preview-horizontal, .preview-parallel, .preview-horizontal-full'
341- } ) ;
342- } ,
343- } ,
344- {
345- label : "Decrease LineHeight" ,
346- accelerator : "CommandOrControl+L" ,
347- click : ( ) => {
348- mainWindow . webContents . send ( 'update-preview-spacing' , {
349- action : 'decrease' ,
350- selector : '.preview-horizontal, .preview-parallel, .preview-horizontal-full'
351- } ) ;
352- } ,
353- } ,
354- ] ,
355- } ,
356- { role : "toggledevtools" } ,
357- ] ,
358- } ,
359- {
360- label : "Help" ,
361- submenu : [
362- {
363- label : 'Check for Updates' ,
364- click : ( ) => {
365- const iconPath = path . join ( __dirname , 'public' , process . platform === 'win32' ? 'icon.ico' : 'icon.png' ) ;
366- releaseWindow = new BrowserWindow ( {
367- width : 1270 ,
368- height : 600 ,
369- modal : true ,
370- icon : iconPath ,
371- parent : mainWindow ,
372- webPreferences : {
373- nodeIntegration : true ,
374- contextIsolation : false ,
375- } ,
376- } ) ;
377- releaseWindow . setMenuBarVisibility ( false ) ;
378- releaseWindow . loadFile ( path . join ( __dirname , 'release' , 'release.html' ) ) ;
379- releaseWindow . webContents . on ( 'will-navigate' , ( event , url ) => {
380- event . preventDefault ( ) ;
381- openLinkInNewWindow ( url ) ;
382- } ) ;
253+ // function createMenuTemplate() {
254+ // const menuTemplate = [
255+ // {
256+ // label: "File",
257+ // submenu: [
258+ // {
259+ // label: "Open File",
260+ // accelerator: "CmdOrCtrl+O",
261+ // click: async () => {
262+ // const result = await dialog.showOpenDialog({
263+ // properties: ['openFile']
264+ // });
265+ // if (!result.canceled) {
266+ // try {
267+ // const filePath = result.filePaths[0];
268+ // const content = await fsPromises.readFile(filePath, 'utf-8');
269+ // mainWindow.webContents.send('file-opened', content);
270+ // } catch (err) {
271+ // console.error('Error reading file:', err);
272+ // }
273+ // }
274+ // }
275+ // },
276+ // { role: "reload" },
277+ // {
278+ // label: 'Exit',
279+ // accelerator: 'Ctrl+Q',
280+ // click: () => {
281+ // try {
282+ // // Save bounds for all open windows before quitting
283+ // BrowserWindow.getAllWindows().forEach(w => {
284+ // try {
285+ // if (w && !w.isDestroyed()) saveConfig(w);
286+ // } catch (e) {
287+ // console.error('Error saving window during Exit:', e);
288+ // }
289+ // });
290+ // } catch (e) {
291+ // console.error('Error during Exit save loop:', e);
292+ // } finally {
293+ // // Use app.quit() — let Electron close windows gracefully
294+ // app.quit();
295+ // }
296+ // }
297+ // },
298+ // ],
299+ // },
300+ // {
301+ // label: "Edit",
302+ // submenu: [
303+ // { role: "undo" },
304+ // { role: "redo" },
305+ // { type: "separator" },
306+ // { role: "cut" },
307+ // { role: "copy" },
308+ // { role: "paste" },
309+ // { role: "delete" },
310+ // { role: "selectall" },
311+ // ],
312+ // },
313+ // {
314+ // label: "View",
315+ // submenu: [
316+ // {
317+ // label: "Go Back",
318+ // accelerator: "CommandOrControl+B",
319+ // click: () => {
320+ // const focusedWindow = BrowserWindow.getFocusedWindow();
321+ // if (focusedWindow && focusedWindow.webContents.navigationHistory.canGoBack()) {
322+ // focusedWindow.webContents.navigationHistory.goBack();
323+ // }
324+ // },
325+ // },
326+ // { type: "separator" },
327+ // { role: "resetzoom" },
328+ // { role: "zoomin" },
329+ // { role: "zoomout" },
330+ // { type: "separator" },
331+ // {
332+ // label: "PreviewPanel",
333+ // submenu: [
334+ // {
335+ // label: "Increase LineHeight",
336+ // accelerator: "CommandOrControl+M",
337+ // click: () => {
338+ // mainWindow.webContents.send('update-preview-spacing', {
339+ // action: 'increase',
340+ // selector: '.preview-horizontal, .preview-parallel, .preview-horizontal-full'
341+ // });
342+ // },
343+ // },
344+ // {
345+ // label: "Decrease LineHeight",
346+ // accelerator: "CommandOrControl+L",
347+ // click: () => {
348+ // mainWindow.webContents.send('update-preview-spacing', {
349+ // action: 'decrease',
350+ // selector: '.preview-horizontal, .preview-parallel, .preview-horizontal-full'
351+ // });
352+ // },
353+ // },
354+ // ],
355+ // },
356+ // { role: "toggledevtools" },
357+ // ],
358+ // },
359+ // {
360+ // label: "Help",
361+ // submenu: [
362+ // {
363+ // label: 'Check for Updates',
364+ // click: () => {
365+ // const iconPath = path.join(__dirname, 'public', process.platform === 'win32' ? 'icon.ico' : 'icon.png');
366+ // releaseWindow = new BrowserWindow({
367+ // width: 1270,
368+ // height: 600,
369+ // modal: true,
370+ // icon: iconPath,
371+ // parent: mainWindow,
372+ // webPreferences: {
373+ // nodeIntegration: true,
374+ // contextIsolation: false,
375+ // },
376+ // });
377+ // releaseWindow.setMenuBarVisibility(false);
378+ // releaseWindow.loadFile(path.join(__dirname, 'release','release.html'));
379+ // releaseWindow.webContents.on('will-navigate', (event, url) => {
380+ // event.preventDefault();
381+ // openLinkInNewWindow(url);
382+ // });
383383
384- releaseWindow . webContents . setWindowOpenHandler ( ( { url } ) => {
385- openLinkInNewWindow ( url ) ;
386- return { action : 'deny' } ;
387- } ) ;
388- } ,
389- } ,
390- { type : "separator" } ,
391- {
392- label : 'About' ,
393- click : ( ) => {
394- const iconPath = path . join ( __dirname , 'public' , process . platform === 'win32' ? 'icon.ico' : 'icon.png' ) ;
395- const aboutWindow = new BrowserWindow ( {
396- width : 1270 ,
397- height : 860 ,
398- modal : true ,
399- icon : iconPath ,
400- parent : mainWindow ,
401- webPreferences : {
402- nodeIntegration : true ,
403- contextIsolation : false ,
404- } ,
405- } ) ;
406- aboutWindow . setMenuBarVisibility ( false ) ;
407- aboutWindow . loadFile ( path . join ( __dirname , 'about' , 'about.html' ) ) ;
408- } ,
409- } ,
410- ] ,
411- }
412- ] ;
413-
414- return menuTemplate ;
415- }
416-
417- function setupMenu ( ) {
418- const menu = Menu . buildFromTemplate ( createMenuTemplate ( ) ) ;
419- Menu . setApplicationMenu ( menu ) ;
420- }
384+ // releaseWindow.webContents.setWindowOpenHandler(({ url }) => {
385+ // openLinkInNewWindow(url);
386+ // return { action: 'deny' };
387+ // });
388+ // },
389+ // },
390+ // { type: "separator" },
391+ // {
392+ // label: 'About',
393+ // click: () => {
394+ // const iconPath = path.join(__dirname, 'public', process.platform === 'win32' ? 'icon.ico' : 'icon.png');
395+ // const aboutWindow = new BrowserWindow({
396+ // width: 1270,
397+ // height: 860,
398+ // modal: true,
399+ // icon: iconPath,
400+ // parent: mainWindow,
401+ // webPreferences: {
402+ // nodeIntegration: true,
403+ // contextIsolation: false,
404+ // },
405+ // });
406+ // aboutWindow.setMenuBarVisibility(false);
407+ // aboutWindow.loadFile(path.join(__dirname, 'about','about.html'));
408+ // },
409+ // },
410+ // ],
411+ // }
412+ // ];
413+
414+ // return menuTemplate;
415+ // }
416+
417+ // function setupMenu() {
418+ // const menu = Menu.buildFromTemplate(createMenuTemplate());
419+ // Menu.setApplicationMenu(menu);
420+ // }
421421
422422// App lifecycle management
423423app . whenReady ( ) . then ( async ( ) => {
0 commit comments