fix: creating placeholder note redirects focus (#601)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user