Skip to content
Next Next commit
feat(main: menu): add File menu
  • Loading branch information
antonreshetov committed Apr 12, 2022
commit 7ec8a58684cc1f0d6870e9f0f9a14d183fd4cb56
32 changes: 32 additions & 0 deletions src/main/menu/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,43 @@ if (isDev) {
})
}

const fileMenu: MenuItemConstructorOptions[] = [
{
label: 'New Snippet',
accelerator: 'CommandOrControl+N',
click: () => {
BrowserWindow.getFocusedWindow()?.webContents.send(
'main-menu:new-snippet'
)
}
},
{
label: 'New Fragment',
accelerator: 'CommandOrControl+T',
click: () => {
BrowserWindow.getFocusedWindow()?.webContents.send(
'main-menu:new-fragment'
)
}
},
{
label: 'New Folder',
accelerator: 'CommandOrControl+Shift+N',
click: () => {
BrowserWindow.getFocusedWindow()?.webContents.send('main-menu:new-folder')
}
}
]

const menuItems: MenuItemConstructorOptions[] = [
{
label: 'massCode',
submenu: isMac ? appMenuMac : appMenu
},
{
label: 'File',
submenu: fileMenu
},
{
label: 'Edit',
role: 'editMenu'
Expand Down