global keyboard shortcuts for quick creating sub-notes under day note

This commit is contained in:
azivner
2018-02-12 23:53:00 -05:00
parent 7bbfef7af3
commit 0e9473119e
5 changed files with 109 additions and 38 deletions

View File

@@ -192,4 +192,22 @@ $(document).ready(() => {
executeScript(script);
}
});
});
});
if (isElectron()) {
require('electron').ipcRenderer.on('create-sub-note', async function(event, message) {
const {parentNoteId, content} = JSON.parse(message);
if (!noteTree.noteExists(parentNoteId)) {
await noteTree.reload();
}
await noteTree.activateNode(parentNoteId);
const node = noteTree.getCurrentNode();
await noteTree.createNote(node, node.data.noteId, 'into', node.data.isProtected);
setTimeout(() => noteEditor.setContent(content), 1000);
});
}