fix: show placeholder note in notes list
This commit is contained in:
@@ -87,12 +87,12 @@ export class AppState {
|
|||||||
* Creates a new editor if one doesn't exist. If one does, we'll replace the
|
* Creates a new editor if one doesn't exist. If one does, we'll replace the
|
||||||
* editor's note with an empty one.
|
* editor's note with an empty one.
|
||||||
*/
|
*/
|
||||||
createEditor(title?: string) {
|
async createEditor(title?: string) {
|
||||||
const activeEditor = this.getActiveEditor();
|
const activeEditor = this.getActiveEditor();
|
||||||
if (!activeEditor || this.multiEditorEnabled) {
|
if (!activeEditor || this.multiEditorEnabled) {
|
||||||
this.application.editorGroup.createEditor(undefined, title);
|
this.application.editorGroup.createEditor(undefined, title);
|
||||||
} else {
|
} else {
|
||||||
activeEditor.reset(title);
|
await activeEditor.reset(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -243,7 +243,8 @@ class NotesViewCtrl extends PureViewCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async selectNote(note: SNNote) {
|
async selectNote(note: SNNote) {
|
||||||
this.appState.openEditor(note.uuid);
|
await this.appState.openEditor(note.uuid);
|
||||||
|
this.reloadNotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
async createNewNote() {
|
async createNewNote() {
|
||||||
@@ -251,7 +252,8 @@ class NotesViewCtrl extends PureViewCtrl {
|
|||||||
if (this.isFiltering()) {
|
if (this.isFiltering()) {
|
||||||
title = this.getState().noteFilter.text;
|
title = this.getState().noteFilter.text;
|
||||||
}
|
}
|
||||||
this.appState.createEditor(title);
|
await this.appState.createEditor(title);
|
||||||
|
await this.reloadNotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleTagChange(tag: SNTag) {
|
async handleTagChange(tag: SNTag) {
|
||||||
@@ -335,8 +337,11 @@ class NotesViewCtrl extends PureViewCtrl {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const notes = this.application.getDisplayableItems(ContentType.Note) as SNNote[];
|
const notes = this.application.getDisplayableItems(ContentType.Note) as SNNote[];
|
||||||
|
if (this.appState.getActiveEditor()?.isTemplateNote) {
|
||||||
|
notes.unshift(this.appState.getActiveEditor()!.note);
|
||||||
|
}
|
||||||
await this.setNotesState({
|
await this.setNotesState({
|
||||||
notes: notes,
|
notes,
|
||||||
renderedNotes: notes.slice(0, this.notesToDisplay)
|
renderedNotes: notes.slice(0, this.notesToDisplay)
|
||||||
});
|
});
|
||||||
this.reloadPanelTitle();
|
this.reloadPanelTitle();
|
||||||
|
|||||||
Reference in New Issue
Block a user