fix: don't deselect active note if in user created view (#1081)

* fix: don't deselect active note if in user created view

* fix: typo

* feat: add utility functions

fix: mobx warning

* fix: react crash

* fix: tag change selection

* feat: add item reload source
This commit is contained in:
Aman Harwara
2022-06-10 18:11:40 +05:30
committed by GitHub
parent a3cb45b413
commit 2ecfcdecb4
7 changed files with 52 additions and 39 deletions

View File

@@ -193,6 +193,20 @@ export class NavigationController extends AbstractViewController {
return this.selected instanceof SmartView && this.selected.uuid === SystemViewId.AllNotes
}
public get isInFilesView(): boolean {
return this.selectedUuid === SystemViewId.Files
}
public isInAnySystemView(): boolean {
return (
this.selected instanceof SmartView && Object.values(SystemViewId).includes(this.selected.uuid as SystemViewId)
)
}
public isInSystemView(id: SystemViewId): boolean {
return this.selected instanceof SmartView && this.selected.uuid === id
}
setAddingSubtagTo(tag: SNTag | undefined): void {
this.addingSubtagTo = tag
}
@@ -259,10 +273,6 @@ export class NavigationController extends AbstractViewController {
}
}
public get isInFilesView(): boolean {
return this.selectedUuid === SystemViewId.Files
}
public get allLocalRootTags(): SNTag[] {
if (this.editing_ instanceof SNTag && this.application.items.isTemplateItem(this.editing_)) {
return [this.editing_, ...this.rootTags]
@@ -389,7 +399,7 @@ export class NavigationController extends AbstractViewController {
}
private setSelectedTagInstance(tag: AnyTag | undefined): void {
this.selected_ = tag
runInAction(() => (this.selected_ = tag))
}
public setExpanded(tag: SNTag, expanded: boolean) {