Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function CommandPalette() {
return
}
if (decryptedItem instanceof SNNote) {
void application.navigationController.selectHomeNavigationView()
application.itemListController.keepActiveItemOpenForSystemView(decryptedItem.uuid)
void application.itemListController.selectItemUsingInstance(decryptedItem, true)
} else if (decryptedItem instanceof FileItem) {
void application.filesController.handleFileAction({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class ItemListController
includeTrashed: false,
includeProtected: true,
}
private keepActiveItemOpenUuid: UuidString | undefined
webDisplayOptions: WebDisplayOptions = {
hideTags: true,
hideDate: false,
Expand Down Expand Up @@ -499,6 +500,10 @@ export class ItemListController
!activeItemExistsInUpdatedResults && !isSearching && this.navigationController.isInAnySystemView()

if (closeBecauseActiveItemDoesntExistInCurrentSystemView) {
if (activeItem && activeItem.uuid === this.keepActiveItemOpenUuid) {
log(LoggingDomain.Selection, 'shouldCloseActiveItem false due to keepActiveItemOpenUuid')
return false
}
log(LoggingDomain.Selection, 'shouldCloseActiveItem closePreviousItemWhenSwitchingToFilesBasedView')
return true
}
Expand Down Expand Up @@ -941,6 +946,7 @@ export class ItemListController
}

handleTagChange = async (userTriggered: boolean) => {
this.clearKeepActiveItemOpenUuid()
const activeNoteController = this.getActiveItemController()
if (activeNoteController instanceof NoteViewController && activeNoteController.isTemplateNote) {
this.closeItemController(activeNoteController)
Expand Down Expand Up @@ -1196,11 +1202,23 @@ export class ItemListController
}
}

if (this.keepActiveItemOpenUuid && uuid !== this.keepActiveItemOpenUuid) {
this.clearKeepActiveItemOpenUuid()
}

return {
didSelect: this.selectedUuids.has(uuid),
}
}

keepActiveItemOpenForSystemView = (noteUuid: UuidString): void => {
this.keepActiveItemOpenUuid = noteUuid
}

private clearKeepActiveItemOpenUuid(): void {
this.keepActiveItemOpenUuid = undefined
}

selectItem = async (
uuid: UuidString,
userTriggered?: boolean,
Expand Down
Loading