fix: creating placeholder note redirects focus (#601)

This commit is contained in:
Gorjan Petrovski
2021-07-15 12:14:28 +02:00
committed by GitHub
parent f5ae75ef26
commit 08ab1d009d

View File

@@ -255,7 +255,7 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
if (selectedTag.isSmartTag && !selectedTag.isAllTag) {
return;
}
return this.createNewNote();
return this.createNewNote(false);
}
streamNotesAndTags() {
@@ -354,7 +354,7 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
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<unknown, NotesCtrlState> {
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) {