From 08ab1d009d2ec99d763a27111eb38fd35412a249 Mon Sep 17 00:00:00 2001 From: Gorjan Petrovski Date: Thu, 15 Jul 2021 12:14:28 +0200 Subject: [PATCH] fix: creating placeholder note redirects focus (#601) --- app/assets/javascripts/views/notes/notes_view.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/views/notes/notes_view.ts b/app/assets/javascripts/views/notes/notes_view.ts index 5ad8a32c8..1911fa0cf 100644 --- a/app/assets/javascripts/views/notes/notes_view.ts +++ b/app/assets/javascripts/views/notes/notes_view.ts @@ -255,7 +255,7 @@ class NotesViewCtrl extends PureViewCtrl { if (selectedTag.isSmartTag && !selectedTag.isAllTag) { return; } - return this.createNewNote(); + return this.createNewNote(false); } streamNotesAndTags() { @@ -354,7 +354,7 @@ class NotesViewCtrl extends PureViewCtrl { await this.appState.notes.selectNote(note.uuid, userTriggered); } - async createNewNote() { + async createNewNote(focusNewNote = true) { this.appState.notes.unselectNotes(); let title = `Note ${this.state.notes.length + 1}`; if (this.isFiltering()) { @@ -365,7 +365,9 @@ class NotesViewCtrl extends PureViewCtrl { await this.reloadNotes(); await this.appState.noteTags.reloadTags(); const noteTitleEditorElement = document.getElementById('note-title-editor'); - noteTitleEditorElement?.focus(); + if (focusNewNote) { + noteTitleEditorElement?.focus(); + } } async handleTagChange(tag: SNTag) {