1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00
Files
Boostnote/lib/main-menu.js
2016-01-09 21:02:30 +09:00

215 lines
4.5 KiB
JavaScript

const electron = require('electron')
const BrowserWindow = electron.BrowserWindow
const shell = electron.shell
const mainWindow = require('./main-window')
const OSX = process.platform === 'darwin'
const WIN = process.platform === 'win32'
var boost = {
label: 'Boostnote',
submenu: [
{
label: 'About Boostnote',
selector: 'orderFrontStandardAboutPanel:'
},
{
type: 'separator'
},
{
label: 'Hide Boostnote',
accelerator: 'Command+H',
selector: 'hide:'
},
{
label: 'Hide Others',
accelerator: 'Command+Shift+H',
selector: 'hideOtherApplications:'
},
{
label: 'Show All',
selector: 'unhideAllApplications:'
},
{
type: 'separator'
},
{
label: 'Quit',
accelerator: 'Command+Q',
selector: 'terminate:'
}
]
}
var file = {
label: 'File',
submenu: [
{
label: 'New Post',
accelerator: OSX ? 'Command + N' : 'Control + N',
click: function () {
mainWindow.webContents.send('top-new-post')
}
},
{
label: 'New Folder',
accelerator: OSX ? 'Command + Shift + N' : 'Control + Shift + N',
click: function () {
mainWindow.webContents.send('nav-new-folder')
}
},
// {
// type: 'separator'
// },
// {
// label: 'Save Post',
// accelerator: OSX ? 'Command + S' : 'Control + S',
// click: function () {
// mainWindow.webContents.send('detail-save')
// }
// },
// {
// label: 'Save All Posts',
// accelerator: OSX ? 'Command + Shift + S' : 'Control + Shift + S',
// click: function () {
// mainWindow.webContents.send('top-save-all')
// }
// },
{
type: 'separator'
},
{
label: 'Delete Post',
accelerator: OSX ? 'Control + Backspace' : 'Control + Delete',
click: function () {
mainWindow.webContents.send('detail-delete')
}
}
]
}
var edit = {
label: 'Edit',
submenu: [
{
label: 'Undo',
accelerator: 'Command+Z',
selector: 'undo:'
},
{
label: 'Redo',
accelerator: 'Shift+Command+Z',
selector: 'redo:'
},
{
type: 'separator'
},
{
label: 'Cut',
accelerator: 'Command+X',
selector: 'cut:'
},
{
label: 'Copy',
accelerator: 'Command+C',
selector: 'copy:'
},
{
label: 'Paste',
accelerator: 'Command+V',
selector: 'paste:'
},
{
label: 'Select All',
accelerator: 'Command+A',
selector: 'selectAll:'
}
]
}
var view = {
label: 'View',
submenu: [
{
label: 'Focus Search',
accelerator: 'Control + Alt + F',
click: function () {
mainWindow.webContents.send('top-focus-search')
}
},
{
type: 'separator'
},
{
label: 'Reload',
accelerator: (function () {
if (process.platform === 'darwin') return 'Command+R'
else return 'Ctrl+R'
})(),
click: function () {
BrowserWindow.getFocusedWindow().reload()
}
},
{
label: 'Toggle Developer Tools',
accelerator: (function () {
if (process.platform === 'darwin') return 'Alt+Command+I'
else return 'Ctrl+Shift+I'
})(),
click: function (item, focusedWindow) {
if (focusedWindow) BrowserWindow.getFocusedWindow().toggleDevTools()
}
}
]
}
var window = {
label: 'Window',
submenu: [
{
label: 'Minimize',
accelerator: 'Command+M',
selector: 'performMiniaturize:'
},
{
label: 'Close',
accelerator: 'Command+W',
selector: 'performClose:'
},
{
type: 'separator'
},
{
label: 'Bring All to Front',
selector: 'arrangeInFront:'
}
]
}
var help = {
label: 'Help',
role: 'help',
submenu: [
{
label: 'Boostnote official site',
click: function () { shell.openExternal('https://b00st.io/') }
},
{
label: 'Tutorial page',
click: function () { shell.openExternal('https://b00st.io/tutorial.html') }
},
{
label: 'Discussions',
click: function () { shell.openExternal('https://github.com/BoostIO/boost-app-discussions/issues') }
},
{
label: 'Changelog',
click: function () { shell.openExternal('https://github.com/BoostIO/boost-releases/blob/master/changelog.md') }
}
]
}
module.exports = process.platform === 'darwin'
? [boost, file, edit, view, window, help]
: [file, view, help]