From 0f5d75391062348668c15bed0877003e6ec52797 Mon Sep 17 00:00:00 2001 From: William Grant Date: Sun, 2 Dec 2018 15:21:01 +0200 Subject: [PATCH 1/4] Removed the old ctrl+d shortcut for deleting a note since we now have the super+shift+backspace shortcut which can be changed in the hotkey settings --- browser/main/NoteList/index.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 08d7d2e2a..730fbd1c2 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -277,12 +277,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() From 5d54ad33420853f7a84eea69bb41e225f337f5e0 Mon Sep 17 00:00:00 2001 From: William Grant Date: Sun, 2 Dec 2018 15:59:47 +0200 Subject: [PATCH 2/4] 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 --- browser/main/NoteList/index.js | 3 ++ lib/main-menu.js | 68 ++++++++++++++++------------------ 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 730fbd1c2..c72c94347 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -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) @@ -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) @@ -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) diff --git a/lib/main-menu.js b/lib/main-menu.js index 91f3c8c65..6bd2bcabf 100644 --- a/lib/main-menu.js +++ b/lib/main-menu.js @@ -85,14 +85,40 @@ 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 ? '' : 'Delete', + accelerator: macOS ? 'Command+Backspace' : 'Control+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: [ @@ -123,33 +149,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') } }, { @@ -162,16 +171,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') - } } ] } @@ -296,9 +295,6 @@ const view = { mainWindow.setFullScreen(!mainWindow.isFullScreen()) } }, - { - type: 'separator' - }, { label: 'Toggle Side Bar', accelerator: 'CommandOrControl+B', From faf2aff959f1ecbca1cfe2dd69d0411277ac3008 Mon Sep 17 00:00:00 2001 From: William Grant Date: Sun, 2 Dec 2018 16:02:29 +0200 Subject: [PATCH 3/4] added in the shift key for deleting a note based on https://github.com/BoostIO/Boostnote/pull/2452 --- lib/main-menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main-menu.js b/lib/main-menu.js index 6bd2bcabf..8317fb693 100644 --- a/lib/main-menu.js +++ b/lib/main-menu.js @@ -93,7 +93,7 @@ const file = { { label: 'Delete Note', accelerator: macOS ? '' : 'Delete', - accelerator: macOS ? 'Command+Backspace' : 'Control+Backspace', + accelerator: macOS ? 'Command+Shift+Backspace' : 'Control+Shift+Backspace', click () { mainWindow.webContents.send('detail:delete') } From 102d13bbae33b6dd47d81208ce7741bc486b3bfb Mon Sep 17 00:00:00 2001 From: William Grant Date: Sun, 2 Dec 2018 16:29:10 +0200 Subject: [PATCH 4/4] you can't have multiple accelerators on a single menu item. Bye bye delete key :( --- lib/main-menu.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/main-menu.js b/lib/main-menu.js index 8317fb693..0ec9e943f 100644 --- a/lib/main-menu.js +++ b/lib/main-menu.js @@ -92,7 +92,6 @@ const file = { }, { label: 'Delete Note', - accelerator: macOS ? '' : 'Delete', accelerator: macOS ? 'Command+Shift+Backspace' : 'Control+Shift+Backspace', click () { mainWindow.webContents.send('detail:delete')