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) {
|
if (selectedTag.isSmartTag && !selectedTag.isAllTag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return this.createNewNote();
|
return this.createNewNote(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
streamNotesAndTags() {
|
streamNotesAndTags() {
|
||||||
@@ -354,7 +354,7 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
|
|||||||
await this.appState.notes.selectNote(note.uuid, userTriggered);
|
await this.appState.notes.selectNote(note.uuid, userTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
async createNewNote() {
|
async createNewNote(focusNewNote = true) {
|
||||||
this.appState.notes.unselectNotes();
|
this.appState.notes.unselectNotes();
|
||||||
let title = `Note ${this.state.notes.length + 1}`;
|
let title = `Note ${this.state.notes.length + 1}`;
|
||||||
if (this.isFiltering()) {
|
if (this.isFiltering()) {
|
||||||
@@ -365,7 +365,9 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
|
|||||||
await this.reloadNotes();
|
await this.reloadNotes();
|
||||||
await this.appState.noteTags.reloadTags();
|
await this.appState.noteTags.reloadTags();
|
||||||
const noteTitleEditorElement = document.getElementById('note-title-editor');
|
const noteTitleEditorElement = document.getElementById('note-title-editor');
|
||||||
noteTitleEditorElement?.focus();
|
if (focusNewNote) {
|
||||||
|
noteTitleEditorElement?.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleTagChange(tag: SNTag) {
|
async handleTagChange(tag: SNTag) {
|
||||||
|
|||||||
Reference in New Issue
Block a user