Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu items overhaul #2666

Merged
merged 4 commits into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions browser/main/NoteList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class NoteList extends React.Component {
this.jumpNoteByHash = this.jumpNoteByHashHandler.bind(this)
this.handleNoteListKeyUp = this.handleNoteListKeyUp.bind(this)
this.getNoteKeyFromTargetIndex = this.getNoteKeyFromTargetIndex.bind(this)
this.cloneNote = this.cloneNote.bind(this)
this.deleteNote = this.deleteNote.bind(this)
this.focusNote = this.focusNote.bind(this)
this.pinToTop = this.pinToTop.bind(this)
Expand All @@ -96,6 +97,7 @@ class NoteList extends React.Component {
this.refreshTimer = setInterval(() => this.forceUpdate(), 60 * 1000)
ee.on('list:next', this.selectNextNoteHandler)
ee.on('list:prior', this.selectPriorNoteHandler)
ee.on('list:clone', this.cloneNote)
ee.on('list:focus', this.focusHandler)
ee.on('list:isMarkdownNote', this.alertIfSnippetHandler)
ee.on('import:file', this.importFromFileHandler)
Expand All @@ -118,6 +120,7 @@ class NoteList extends React.Component {

ee.off('list:next', this.selectNextNoteHandler)
ee.off('list:prior', this.selectPriorNoteHandler)
ee.off('list:clone', this.cloneNote)
ee.off('list:focus', this.focusHandler)
ee.off('list:isMarkdownNote', this.alertIfSnippetHandler)
ee.off('import:file', this.importFromFileHandler)
Expand Down Expand Up @@ -277,12 +280,6 @@ class NoteList extends React.Component {
ee.emit('top:new-note')
}

// D key
if (e.keyCode === 68) {
e.preventDefault()
this.deleteNote()
}

// E key
if (e.keyCode === 69) {
e.preventDefault()
Expand Down
67 changes: 31 additions & 36 deletions lib/main-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,39 @@ const file = {
},
{
label: 'Focus Note',
accelerator: 'Control+E',
accelerator: macOS ? 'Command+E' : 'Control+E',
click () {
mainWindow.webContents.send('detail:focus')
}
},
{
label: 'Delete Note',
accelerator: macOS ? 'Command+Shift+Backspace' : 'Control+Shift+Backspace',
click () {
mainWindow.webContents.send('detail:delete')
}
},
{
label: 'Clone Note',
accelerator: macOS ? 'Command+D' : 'Control+D',
click () {
mainWindow.webContents.send('list:clone')
}
},
{
type: 'separator'
},
{
label: 'Import from',
submenu: [
{
label: 'Plain Text, MarkDown (.txt, .md)',
click () {
mainWindow.webContents.send('import:file')
}
}
]
},
{
label: 'Export as',
submenu: [
Expand Down Expand Up @@ -123,33 +148,16 @@ const file = {
type: 'separator'
},
{
label: 'Import from',
submenu: [
{
label: 'Plain Text, MarkDown (.txt, .md)',
click () {
mainWindow.webContents.send('import:file')
}
}
]
},
{
type: 'separator'
},
{
label: 'Format Table',
label: 'Generate/Update Markdown TOC',
accelerator: 'Shift+Ctrl+T',
click () {
mainWindow.webContents.send('code:format-table')
mainWindow.webContents.send('code:generate-toc')
}
},
{
type: 'separator'
},
{
label: 'Generate/Update Markdown TOC',
accelerator: 'Shift+Ctrl+T',
label: 'Format Table',
click () {
mainWindow.webContents.send('code:generate-toc')
mainWindow.webContents.send('code:format-table')
}
},
{
Expand All @@ -162,16 +170,6 @@ const file = {
mainWindow.webContents.send('list:isMarkdownNote')
mainWindow.webContents.send('print')
}
},
{
type: 'separator'
},
{
label: 'Delete Note',
accelerator: macOS ? 'Control+Backspace' : 'Control+Delete',
click () {
mainWindow.webContents.send('detail:delete')
}
}
]
}
Expand Down Expand Up @@ -296,9 +294,6 @@ const view = {
mainWindow.setFullScreen(!mainWindow.isFullScreen())
}
},
{
type: 'separator'
},
{
label: 'Toggle Side Bar',
accelerator: 'CommandOrControl+B',
Expand Down