Select items after load
This commit is contained in:
parent
0db6e411c3
commit
c38d8e0264
@ -244,6 +244,7 @@ struct MainView: App {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
content.loadFromDisk { errors in
|
content.loadFromDisk { errors in
|
||||||
|
prepareAfterLoad()
|
||||||
guard !errors.isEmpty else {
|
guard !errors.isEmpty else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -252,6 +253,21 @@ struct MainView: App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func prepareAfterLoad() {
|
||||||
|
if selectedPost == nil {
|
||||||
|
selectedPost = content.posts.first
|
||||||
|
}
|
||||||
|
if selectedPage == nil {
|
||||||
|
selectedPage = content.pages.first
|
||||||
|
}
|
||||||
|
if selectedTag == nil {
|
||||||
|
selectedTag = content.tags.first
|
||||||
|
}
|
||||||
|
if selectedFile == nil {
|
||||||
|
selectedFile = content.files.first
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func showInitialSheet() {
|
private func showInitialSheet() {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
selectedSection = .folders
|
selectedSection = .folders
|
||||||
|
Loading…
x
Reference in New Issue
Block a user