From 597eb5a30000f52b52b84b09d9723d6164d6d7bd Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 19 May 2019 10:46:19 +0200 Subject: [PATCH] ctrl+alt+p will create new note in a new tab --- src/public/javascripts/desktop.js | 2 ++ src/public/javascripts/services/note_detail.js | 9 ++++++--- src/public/javascripts/services/tab_context.js | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/public/javascripts/desktop.js b/src/public/javascripts/desktop.js index 30df2dcd2..f1ff1f57b 100644 --- a/src/public/javascripts/desktop.js +++ b/src/public/javascripts/desktop.js @@ -120,6 +120,8 @@ if (utils.isElectron()) { const todayNote = await dateNoteService.getTodayNote(); const node = await treeService.expandToNote(todayNote.noteId); + await noteDetailService.openEmptyTab(false); + await treeService.createNote(node, todayNote.noteId, 'into', { type: "text", isProtected: node.data.isProtected diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js index 86ed3c397..20eaa889c 100644 --- a/src/public/javascripts/services/note_detail.js +++ b/src/public/javascripts/services/note_detail.js @@ -335,11 +335,13 @@ $tabContentsContainer.on("drop", e => { }); }); -async function openEmptyTab() { +async function openEmptyTab(render = true) { const ctx = new TabContext(tabRow); tabContexts.push(ctx); - await renderComponent(ctx); + if (render) { + await renderComponent(ctx); + } await tabRow.activateTab(ctx.$tab[0]); } @@ -493,5 +495,6 @@ export default { isActive, activateTabContext, clearOpenTabsTask, - filterTabs + filterTabs, + openEmptyTab }; \ No newline at end of file diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.js index 9a40630a4..7088a2c6d 100644 --- a/src/public/javascripts/services/tab_context.js +++ b/src/public/javascripts/services/tab_context.js @@ -68,6 +68,7 @@ class TabContext { const title = this.$noteTitle.val(); + this.tabRow.updateTab(this.$tab[0], {title}); treeService.setNoteTitle(this.noteId, title); });