From 5350496ed441046e067ee6cd5824e3c570e1456c Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 20 Dec 2019 20:13:21 +0100 Subject: [PATCH] fix creating note from global ctrl+alt+p shortcut, closes #773 --- src/public/javascripts/services/entrypoints.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js index b8f4aa1bf..b5f9e352b 100644 --- a/src/public/javascripts/services/entrypoints.js +++ b/src/public/javascripts/services/entrypoints.js @@ -9,6 +9,7 @@ import noteDetailService from "./note_detail.js"; import keyboardActionService from "./keyboard_actions.js"; import hoistedNoteService from "./hoisted_note.js"; import treeCache from "./tree_cache.js"; +import server from "./server.js"; const NOTE_REVISIONS = "../dialogs/note_revisions.js"; const OPTIONS = "../dialogs/options.js"; @@ -232,15 +233,16 @@ function registerEntrypoints() { keyboardActionService.setGlobalActionHandler("CreateNoteIntoDayNote", async () => { const todayNote = await dateNoteService.getTodayNote(); - const notePath = await treeService.getSomeNotePath(todayNote); - const node = await treeService.expandToNote(notePath); - - const {note} = await treeService.createNote(node, todayNote.noteId, 'into', { - type: "text", - isProtected: node.data.isProtected + const {note} = await server.post(`notes/${todayNote.noteId}/children?target=into`, { + title: 'new note', + content: '', + type: 'text', + isProtected: todayNote.isProtected }); + await treeService.expandToNote(note.noteId); + await noteDetailService.openInTab(note.noteId, true); });