Reset selected file on delete

This commit is contained in:
Christoph Hagen
2025-01-07 14:30:46 +01:00
parent e670cefb34
commit 7b723add3e
3 changed files with 10 additions and 14 deletions

View File

@ -37,6 +37,9 @@ final class Content: ObservableObject {
@Published
private(set) var shouldGenerateWebsite = false
@State
var selectedFile: FileResource?
let imageGenerator: ImageGenerator
init(settings: Settings,
@ -135,7 +138,9 @@ final class Content: ObservableObject {
tag.remove(file)
}
settings.remove(file)
#warning("Remove MainView.selectedFile when deleting file")
if selectedFile == file {
selectedFile = nil
}
}
func file(withOutputPath: String) -> FileResource? {