Skip to content

Commit 5d54ad3

Browse files
committed
Cleaned up menu items ordering and separators, added clone note menu item and shortcut, updated focus note shortcut to be mac friendly, made delete note shortcut use either command+backspace or ctrl+backspace and the delete key on windows and linux machines
1 parent 0f5d753 commit 5d54ad3

File tree

2 files changed

+35
-36
lines changed

2 files changed

+35
-36
lines changed

browser/main/NoteList/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class NoteList extends React.Component {
7171
this.jumpNoteByHash = this.jumpNoteByHashHandler.bind(this)
7272
this.handleNoteListKeyUp = this.handleNoteListKeyUp.bind(this)
7373
this.getNoteKeyFromTargetIndex = this.getNoteKeyFromTargetIndex.bind(this)
74+
this.cloneNote = this.cloneNote.bind(this)
7475
this.deleteNote = this.deleteNote.bind(this)
7576
this.focusNote = this.focusNote.bind(this)
7677
this.pinToTop = this.pinToTop.bind(this)
@@ -96,6 +97,7 @@ class NoteList extends React.Component {
9697
this.refreshTimer = setInterval(() => this.forceUpdate(), 60 * 1000)
9798
ee.on('list:next', this.selectNextNoteHandler)
9899
ee.on('list:prior', this.selectPriorNoteHandler)
100+
ee.on('list:clone', this.cloneNote)
99101
ee.on('list:focus', this.focusHandler)
100102
ee.on('list:isMarkdownNote', this.alertIfSnippetHandler)
101103
ee.on('import:file', this.importFromFileHandler)
@@ -118,6 +120,7 @@ class NoteList extends React.Component {
118120

119121
ee.off('list:next', this.selectNextNoteHandler)
120122
ee.off('list:prior', this.selectPriorNoteHandler)
123+
ee.off('list:clone', this.cloneNote)
121124
ee.off('list:focus', this.focusHandler)
122125
ee.off('list:isMarkdownNote', this.alertIfSnippetHandler)
123126
ee.off('import:file', this.importFromFileHandler)

lib/main-menu.js

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,40 @@ const file = {
8585
},
8686
{
8787
label: 'Focus Note',
88-
accelerator: 'Control+E',
88+
accelerator: macOS ? 'Command+E' : 'Control+E',
8989
click () {
9090
mainWindow.webContents.send('detail:focus')
9191
}
9292
},
93+
{
94+
label: 'Delete Note',
95+
accelerator: macOS ? '' : 'Delete',
96+
accelerator: macOS ? 'Command+Backspace' : 'Control+Backspace',
97+
click () {
98+
mainWindow.webContents.send('detail:delete')
99+
}
100+
},
101+
{
102+
label: 'Clone Note',
103+
accelerator: macOS ? 'Command+D' : 'Control+D',
104+
click () {
105+
mainWindow.webContents.send('list:clone')
106+
}
107+
},
93108
{
94109
type: 'separator'
95110
},
111+
{
112+
label: 'Import from',
113+
submenu: [
114+
{
115+
label: 'Plain Text, MarkDown (.txt, .md)',
116+
click () {
117+
mainWindow.webContents.send('import:file')
118+
}
119+
}
120+
]
121+
},
96122
{
97123
label: 'Export as',
98124
submenu: [
@@ -123,33 +149,16 @@ const file = {
123149
type: 'separator'
124150
},
125151
{
126-
label: 'Import from',
127-
submenu: [
128-
{
129-
label: 'Plain Text, MarkDown (.txt, .md)',
130-
click () {
131-
mainWindow.webContents.send('import:file')
132-
}
133-
}
134-
]
135-
},
136-
{
137-
type: 'separator'
138-
},
139-
{
140-
label: 'Format Table',
152+
label: 'Generate/Update Markdown TOC',
153+
accelerator: 'Shift+Ctrl+T',
141154
click () {
142-
mainWindow.webContents.send('code:format-table')
155+
mainWindow.webContents.send('code:generate-toc')
143156
}
144157
},
145158
{
146-
type: 'separator'
147-
},
148-
{
149-
label: 'Generate/Update Markdown TOC',
150-
accelerator: 'Shift+Ctrl+T',
159+
label: 'Format Table',
151160
click () {
152-
mainWindow.webContents.send('code:generate-toc')
161+
mainWindow.webContents.send('code:format-table')
153162
}
154163
},
155164
{
@@ -162,16 +171,6 @@ const file = {
162171
mainWindow.webContents.send('list:isMarkdownNote')
163172
mainWindow.webContents.send('print')
164173
}
165-
},
166-
{
167-
type: 'separator'
168-
},
169-
{
170-
label: 'Delete Note',
171-
accelerator: macOS ? 'Control+Backspace' : 'Control+Delete',
172-
click () {
173-
mainWindow.webContents.send('detail:delete')
174-
}
175174
}
176175
]
177176
}
@@ -296,9 +295,6 @@ const view = {
296295
mainWindow.setFullScreen(!mainWindow.isFullScreen())
297296
}
298297
},
299-
{
300-
type: 'separator'
301-
},
302298
{
303299
label: 'Toggle Side Bar',
304300
accelerator: 'CommandOrControl+B',

0 commit comments

Comments
 (0)