diff --git a/app/assets/javascripts/ui_models/app_state/app_state.ts b/app/assets/javascripts/ui_models/app_state/app_state.ts index 04fa7ff4b..0a897f55a 100644 --- a/app/assets/javascripts/ui_models/app_state/app_state.ts +++ b/app/assets/javascripts/ui_models/app_state/app_state.ts @@ -246,11 +246,16 @@ export class AppState { } if (note.deleted) { this.closeEditor(editor); - } else if (note.trashed && !this.selectedTag?.isTrashTag) { + } else if ( + note.trashed && + !this.selectedTag?.isTrashTag && + !this.searchOptions.includeTrashed + ) { this.closeEditor(editor); } else if ( note.archived && !this.selectedTag?.isArchiveTag && + !this.searchOptions.includeArchived && !this.application.getPreference(PrefKey.NotesShowArchived, false) ) { this.closeEditor(editor); diff --git a/app/assets/javascripts/views/notes/notes_view.ts b/app/assets/javascripts/views/notes/notes_view.ts index 1911fa0cf..f1babb53b 100644 --- a/app/assets/javascripts/views/notes/notes_view.ts +++ b/app/assets/javascripts/views/notes/notes_view.ts @@ -277,7 +277,11 @@ class NotesViewCtrl extends PureViewCtrl { if (this.application.getAppState().notes.selectedNotesCount < 2) { if (activeNote) { const discarded = activeNote.deleted || activeNote.trashed; - if (discarded && !this.appState?.selectedTag?.isTrashTag) { + if ( + discarded && + !this.appState?.selectedTag?.isTrashTag && + !this.appState?.searchOptions.includeTrashed + ) { this.selectNextOrCreateNew(); } else if (!this.state.selectedNotes[activeNote.uuid]) { this.selectNote(activeNote);