mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
fixed eslint error & integrated with prettier as well as formatted the whole codebase (#3450)
This commit is contained in:
257
lib/main-menu.js
257
lib/main-menu.js
@@ -11,68 +11,68 @@ const LINUX = process.platform === 'linux'
|
||||
|
||||
const boost = macOS
|
||||
? {
|
||||
label: 'Boostnote',
|
||||
submenu: [
|
||||
{
|
||||
label: 'About Boostnote',
|
||||
selector: 'orderFrontStandardAboutPanel:'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Preferences',
|
||||
accelerator: 'Command+,',
|
||||
click () {
|
||||
mainWindow.webContents.send('side:preferences')
|
||||
label: 'Boostnote',
|
||||
submenu: [
|
||||
{
|
||||
label: 'About Boostnote',
|
||||
selector: 'orderFrontStandardAboutPanel:'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Preferences',
|
||||
accelerator: 'Command+,',
|
||||
click() {
|
||||
mainWindow.webContents.send('side:preferences')
|
||||
}
|
||||
},
|
||||
{
|
||||
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 Boostnote',
|
||||
role: 'quit',
|
||||
accelerator: 'CommandOrControl+Q'
|
||||
}
|
||||
},
|
||||
{
|
||||
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 Boostnote',
|
||||
role: 'quit',
|
||||
accelerator: 'CommandOrControl+Q'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
: {
|
||||
label: 'Boostnote',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Preferences',
|
||||
accelerator: 'Control+,',
|
||||
click () {
|
||||
mainWindow.webContents.send('side:preferences')
|
||||
label: 'Boostnote',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Preferences',
|
||||
accelerator: 'Control+,',
|
||||
click() {
|
||||
mainWindow.webContents.send('side:preferences')
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'quit',
|
||||
accelerator: 'Control+Q'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'quit',
|
||||
accelerator: 'Control+Q'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const file = {
|
||||
label: 'File',
|
||||
@@ -80,28 +80,28 @@ const file = {
|
||||
{
|
||||
label: 'New Note',
|
||||
accelerator: 'CommandOrControl+N',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('top:new-note')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Focus Note',
|
||||
accelerator: 'CommandOrControl+E',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('detail:focus')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Delete Note',
|
||||
accelerator: 'CommandOrControl+Shift+Backspace',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('detail:delete')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Clone Note',
|
||||
accelerator: 'CommandOrControl+D',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('list:clone')
|
||||
}
|
||||
},
|
||||
@@ -113,7 +113,7 @@ const file = {
|
||||
submenu: [
|
||||
{
|
||||
label: 'Plain Text, MarkDown (.txt, .md)',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('import:file')
|
||||
}
|
||||
}
|
||||
@@ -124,28 +124,28 @@ const file = {
|
||||
submenu: [
|
||||
{
|
||||
label: 'Plain Text (.txt)',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('list:isMarkdownNote', 'export-txt')
|
||||
mainWindow.webContents.send('export:save-text')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'MarkDown (.md)',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('list:isMarkdownNote', 'export-md')
|
||||
mainWindow.webContents.send('export:save-md')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'HTML (.html)',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('list:isMarkdownNote', 'export-html')
|
||||
mainWindow.webContents.send('export:save-html')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'PDF (.pdf)',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('list:isMarkdownNote', 'export-pdf')
|
||||
mainWindow.webContents.send('export:save-pdf')
|
||||
}
|
||||
@@ -158,13 +158,13 @@ const file = {
|
||||
{
|
||||
label: 'Generate/Update Markdown TOC',
|
||||
accelerator: 'Shift+Ctrl+T',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('code:generate-toc')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Format Table',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('code:format-table')
|
||||
}
|
||||
},
|
||||
@@ -174,7 +174,7 @@ const file = {
|
||||
{
|
||||
label: 'Print',
|
||||
accelerator: 'CommandOrControl+P',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('list:isMarkdownNote', 'print')
|
||||
mainWindow.webContents.send('print')
|
||||
}
|
||||
@@ -183,20 +183,25 @@ const file = {
|
||||
}
|
||||
|
||||
if (LINUX) {
|
||||
file.submenu.push({
|
||||
type: 'separator'
|
||||
}, {
|
||||
label: 'Preferences',
|
||||
accelerator: 'Control+,',
|
||||
click () {
|
||||
mainWindow.webContents.send('side:preferences')
|
||||
file.submenu.push(
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Preferences',
|
||||
accelerator: 'Control+,',
|
||||
click() {
|
||||
mainWindow.webContents.send('side:preferences')
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'quit',
|
||||
accelerator: 'Control+Q'
|
||||
}
|
||||
}, {
|
||||
type: 'separator'
|
||||
}, {
|
||||
role: 'quit',
|
||||
accelerator: 'Control+Q'
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
const edit = {
|
||||
@@ -241,7 +246,7 @@ const edit = {
|
||||
{
|
||||
label: 'Add Tag',
|
||||
accelerator: 'CommandOrControl+Shift+T',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('editor:add-tag')
|
||||
}
|
||||
}
|
||||
@@ -254,14 +259,14 @@ const view = {
|
||||
{
|
||||
label: 'Reload',
|
||||
accelerator: 'CommandOrControl+R',
|
||||
click () {
|
||||
click() {
|
||||
BrowserWindow.getFocusedWindow().reload()
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Toggle Developer Tools',
|
||||
accelerator: 'CommandOrControl+Alt+I',
|
||||
click () {
|
||||
click() {
|
||||
BrowserWindow.getFocusedWindow().toggleDevTools()
|
||||
}
|
||||
},
|
||||
@@ -271,14 +276,14 @@ const view = {
|
||||
{
|
||||
label: 'Next Note',
|
||||
accelerator: 'CommandOrControl+]',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('list:next')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Previous Note',
|
||||
accelerator: 'CommandOrControl+[',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('list:prior')
|
||||
}
|
||||
},
|
||||
@@ -288,7 +293,7 @@ const view = {
|
||||
{
|
||||
label: 'Focus Search',
|
||||
accelerator: 'CommandOrControl+Shift+L',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('top:focus-search')
|
||||
}
|
||||
},
|
||||
@@ -298,14 +303,14 @@ const view = {
|
||||
{
|
||||
label: 'Toggle Full Screen',
|
||||
accelerator: macOS ? 'Command+Control+F' : 'F11',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.setFullScreen(!mainWindow.isFullScreen())
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Toggle Side Bar',
|
||||
accelerator: 'CommandOrControl+B',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('editor:fullscreen')
|
||||
}
|
||||
},
|
||||
@@ -315,21 +320,21 @@ const view = {
|
||||
{
|
||||
label: 'Actual Size',
|
||||
accelerator: 'CommandOrControl+0',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('status:zoomreset')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Zoom In',
|
||||
accelerator: 'CommandOrControl+=',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('status:zoomin')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Zoom Out',
|
||||
accelerator: 'CommandOrControl+-',
|
||||
click () {
|
||||
click() {
|
||||
mainWindow.webContents.send('status:zoomout')
|
||||
}
|
||||
}
|
||||
@@ -382,38 +387,58 @@ const help = {
|
||||
submenu: [
|
||||
{
|
||||
label: 'Boostnote official site',
|
||||
click () { shell.openExternal('https://boostnote.io/') }
|
||||
click() {
|
||||
shell.openExternal('https://boostnote.io/')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Wiki',
|
||||
click () { shell.openExternal('https://github.com/BoostIO/Boostnote/wiki') }
|
||||
click() {
|
||||
shell.openExternal('https://github.com/BoostIO/Boostnote/wiki')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Issue Tracker',
|
||||
click () { shell.openExternal('https://github.com/BoostIO/Boostnote/issues') }
|
||||
click() {
|
||||
shell.openExternal('https://github.com/BoostIO/Boostnote/issues')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Changelog',
|
||||
click () { shell.openExternal('https://github.com/BoostIO/boost-releases') }
|
||||
click() {
|
||||
shell.openExternal('https://github.com/BoostIO/boost-releases')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Cheatsheets',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Markdown',
|
||||
click () { shell.openExternal('https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet') }
|
||||
click() {
|
||||
shell.openExternal(
|
||||
'https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet'
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Latex',
|
||||
click () { shell.openExternal('https://katex.org/docs/supported.html') }
|
||||
click() {
|
||||
shell.openExternal('https://katex.org/docs/supported.html')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'HTML',
|
||||
click () { shell.openExternal('https://htmlcheatsheet.com/') }
|
||||
click() {
|
||||
shell.openExternal('https://htmlcheatsheet.com/')
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Boostnote',
|
||||
click () { shell.openExternal('https://github.com/TobseF/boostnote-markdown-cheatsheet/blob/master/BOOSTNOTE_MARKDOWN_CHEAT_SHEET.md') }
|
||||
click() {
|
||||
shell.openExternal(
|
||||
'https://github.com/TobseF/boostnote-markdown-cheatsheet/blob/master/BOOSTNOTE_MARKDOWN_CHEAT_SHEET.md'
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -422,7 +447,7 @@ const help = {
|
||||
},
|
||||
{
|
||||
label: 'About',
|
||||
click () {
|
||||
click() {
|
||||
const version = electron.app.getVersion()
|
||||
const electronVersion = process.versions.electron
|
||||
const chromeVersion = process.versions.chrome
|
||||
@@ -430,20 +455,20 @@ const help = {
|
||||
const v8Version = process.versions.v8
|
||||
const OSInfo = `${os.type()} ${os.arch()} ${os.release()}`
|
||||
const detail = `Version: ${version}\nElectron: ${electronVersion}\nChrome: ${chromeVersion}\nNode.js: ${nodeVersion}\nV8: ${v8Version}\nOS: ${OSInfo}`
|
||||
electron.dialog.showMessageBox(BrowserWindow.getFocusedWindow(),
|
||||
{
|
||||
title: 'BoostNote',
|
||||
message: 'BoostNote',
|
||||
type: 'info',
|
||||
detail: `\n${detail}`
|
||||
})
|
||||
electron.dialog.showMessageBox(BrowserWindow.getFocusedWindow(), {
|
||||
title: 'BoostNote',
|
||||
message: 'BoostNote',
|
||||
type: 'info',
|
||||
detail: `\n${detail}`
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
module.exports = process.platform === 'darwin'
|
||||
? [boost, file, edit, view, window, help]
|
||||
: process.platform === 'win32'
|
||||
? [boost, file, view, help]
|
||||
: [file, view, help]
|
||||
module.exports =
|
||||
process.platform === 'darwin'
|
||||
? [boost, file, edit, view, window, help]
|
||||
: process.platform === 'win32'
|
||||
? [boost, file, view, help]
|
||||
: [file, view, help]
|
||||
|
||||
Reference in New Issue
Block a user