fix: Keeps note active even if it's not on the current view when coming from command palette (#2979) [skip e2e]
This commit is contained in:
committed by
GitHub
parent
bdd78aade3
commit
e63be048f4
@@ -177,7 +177,7 @@ function CommandPalette() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (decryptedItem instanceof SNNote) {
|
if (decryptedItem instanceof SNNote) {
|
||||||
void application.navigationController.selectHomeNavigationView()
|
application.itemListController.keepActiveItemOpenForSystemView(decryptedItem.uuid)
|
||||||
void application.itemListController.selectItemUsingInstance(decryptedItem, true)
|
void application.itemListController.selectItemUsingInstance(decryptedItem, true)
|
||||||
} else if (decryptedItem instanceof FileItem) {
|
} else if (decryptedItem instanceof FileItem) {
|
||||||
void application.filesController.handleFileAction({
|
void application.filesController.handleFileAction({
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ export class ItemListController
|
|||||||
includeTrashed: false,
|
includeTrashed: false,
|
||||||
includeProtected: true,
|
includeProtected: true,
|
||||||
}
|
}
|
||||||
|
private keepActiveItemOpenUuid: UuidString | undefined
|
||||||
webDisplayOptions: WebDisplayOptions = {
|
webDisplayOptions: WebDisplayOptions = {
|
||||||
hideTags: true,
|
hideTags: true,
|
||||||
hideDate: false,
|
hideDate: false,
|
||||||
@@ -499,6 +500,10 @@ export class ItemListController
|
|||||||
!activeItemExistsInUpdatedResults && !isSearching && this.navigationController.isInAnySystemView()
|
!activeItemExistsInUpdatedResults && !isSearching && this.navigationController.isInAnySystemView()
|
||||||
|
|
||||||
if (closeBecauseActiveItemDoesntExistInCurrentSystemView) {
|
if (closeBecauseActiveItemDoesntExistInCurrentSystemView) {
|
||||||
|
if (activeItem && activeItem.uuid === this.keepActiveItemOpenUuid) {
|
||||||
|
log(LoggingDomain.Selection, 'shouldCloseActiveItem false due to keepActiveItemOpenUuid')
|
||||||
|
return false
|
||||||
|
}
|
||||||
log(LoggingDomain.Selection, 'shouldCloseActiveItem closePreviousItemWhenSwitchingToFilesBasedView')
|
log(LoggingDomain.Selection, 'shouldCloseActiveItem closePreviousItemWhenSwitchingToFilesBasedView')
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -941,6 +946,7 @@ export class ItemListController
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleTagChange = async (userTriggered: boolean) => {
|
handleTagChange = async (userTriggered: boolean) => {
|
||||||
|
this.clearKeepActiveItemOpenUuid()
|
||||||
const activeNoteController = this.getActiveItemController()
|
const activeNoteController = this.getActiveItemController()
|
||||||
if (activeNoteController instanceof NoteViewController && activeNoteController.isTemplateNote) {
|
if (activeNoteController instanceof NoteViewController && activeNoteController.isTemplateNote) {
|
||||||
this.closeItemController(activeNoteController)
|
this.closeItemController(activeNoteController)
|
||||||
@@ -1196,11 +1202,23 @@ export class ItemListController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.keepActiveItemOpenUuid && uuid !== this.keepActiveItemOpenUuid) {
|
||||||
|
this.clearKeepActiveItemOpenUuid()
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
didSelect: this.selectedUuids.has(uuid),
|
didSelect: this.selectedUuids.has(uuid),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keepActiveItemOpenForSystemView = (noteUuid: UuidString): void => {
|
||||||
|
this.keepActiveItemOpenUuid = noteUuid
|
||||||
|
}
|
||||||
|
|
||||||
|
private clearKeepActiveItemOpenUuid(): void {
|
||||||
|
this.keepActiveItemOpenUuid = undefined
|
||||||
|
}
|
||||||
|
|
||||||
selectItem = async (
|
selectItem = async (
|
||||||
uuid: UuidString,
|
uuid: UuidString,
|
||||||
userTriggered?: boolean,
|
userTriggered?: boolean,
|
||||||
|
|||||||
Reference in New Issue
Block a user