From 3b268cc8eb66101266276907efba4a7c57fc4ec9 Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 5 May 2020 21:42:18 +0200 Subject: [PATCH] fix selecting note title after creation, closes #997 --- src/public/app/services/main_tree_executors.js | 16 ++-------------- src/public/app/services/note_create.js | 6 +++++- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/public/app/services/main_tree_executors.js b/src/public/app/services/main_tree_executors.js index 61717e64f..a365393f3 100644 --- a/src/public/app/services/main_tree_executors.js +++ b/src/public/app/services/main_tree_executors.js @@ -38,12 +38,6 @@ export default class MainTreeExecutors extends Component { isProtected: activeNote.isProtected, saveSelection: false }); - - await ws.waitForMaxKnownSyncId(); - - appContext.tabManager.getActiveTabContext().setNote(note.noteId); - - appContext.triggerCommand('focusAndSelectTitle'); } async createNoteAfterCommand() { @@ -55,17 +49,11 @@ export default class MainTreeExecutors extends Component { return; } - const {note} = await noteCreateService.createNote(parentNoteId, { + await noteCreateService.createNote(parentNoteId, { target: 'after', targetBranchId: node.data.branchId, isProtected: isProtected, - saveSelection: true + saveSelection: false }); - - await ws.waitForMaxKnownSyncId(); - - appContext.tabManager.getActiveTabContext().setNote(note.noteId); - - appContext.triggerCommand('focusAndSelectTitle'); } } \ No newline at end of file diff --git a/src/public/app/services/note_create.js b/src/public/app/services/note_create.js index 24501f10c..353bc7a36 100644 --- a/src/public/app/services/note_create.js +++ b/src/public/app/services/note_create.js @@ -48,8 +48,12 @@ async function createNote(parentNoteId, options = {}) { } if (options.activate) { + await ws.waitForMaxKnownSyncId(); + const activeTabContext = appContext.tabManager.getActiveTabContext(); - activeTabContext.setNote(note.noteId); + await activeTabContext.setNote(note.noteId); + + appContext.triggerCommand('focusAndSelectTitle'); } return {note, branch};