From 1cef0ce5f96d59f29e3162cff0828522ba089b20 Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 13 Feb 2018 19:55:04 -0500 Subject: [PATCH] removed CTRL-ALT-C global shortcut with pasting from clipboard, keeping only CTRL-ALT-P without clipboard --- electron.js | 26 ++++---------------------- src/public/javascripts/init.js | 7 ++----- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/electron.js b/electron.js index d66ae3824..e6506cdcb 100644 --- a/electron.js +++ b/electron.js @@ -70,34 +70,16 @@ app.on('activate', () => { app.on('ready', () => { mainWindow = createMainWindow(); - const date_notes = require('./src/services/date_notes'); - const utils = require('./src/services/utils'); - globalShortcut.register('CommandOrControl+Alt+P', async () => { + const date_notes = require('./src/services/date_notes'); + const utils = require('./src/services/utils'); + const parentNoteId = await date_notes.getDateNoteId(utils.nowDate()); // window may be hidden / not in focus mainWindow.focus(); - mainWindow.webContents.send('create-sub-note', JSON.stringify({ - parentNoteId: parentNoteId, - content: '' - })); - }); - - globalShortcut.register('CommandOrControl+Alt+C', async () => { - const parentNoteId = await date_notes.getDateNoteId(utils.nowDate()); - - // window may be hidden / not in focus - mainWindow.focus(); - - let content = clipboard.readText(); - content = content.replace(/(\r\n|\n)/g, "

"); - - mainWindow.webContents.send('create-sub-note', JSON.stringify({ - parentNoteId: parentNoteId, - content: content - })); + mainWindow.webContents.send('create-day-sub-note', parentNoteId); }); }); diff --git a/src/public/javascripts/init.js b/src/public/javascripts/init.js index 8611262c7..0eb294fdc 100644 --- a/src/public/javascripts/init.js +++ b/src/public/javascripts/init.js @@ -199,9 +199,8 @@ $(document).ready(() => { }); if (isElectron()) { - require('electron').ipcRenderer.on('create-sub-note', async function(event, message) { - const {parentNoteId, content} = JSON.parse(message); - + require('electron').ipcRenderer.on('create-day-sub-note', async function(event, parentNoteId) { + // this might occur when day note had to be created if (!noteTree.noteExists(parentNoteId)) { await noteTree.reload(); } @@ -211,7 +210,5 @@ if (isElectron()) { const node = noteTree.getCurrentNode(); await noteTree.createNote(node, node.data.noteId, 'into', node.data.isProtected); - - setTimeout(() => noteEditor.setContent(content), 1000); }); } \ No newline at end of file