Fix file deletion

This commit is contained in:
Christoph Hagen
2025-01-07 14:04:00 +01:00
parent c5a00ef0f8
commit acd0902869
10 changed files with 98 additions and 3 deletions

View File

@@ -123,6 +123,22 @@ final class Content: ObservableObject {
func remove(_ file: FileResource) {
files.remove(file)
#warning("Remove file from required files, thumbnails, post images, etc.")
for post in posts {
post.remove(file)
}
for page in pages {
page.remove(file)
}
for tag in tags {
tag.remove(file)
}
settings.remove(file)
#warning("Remove MainView.selectedFile when deleting file")
}
func file(withOutputPath: String) -> FileResource? {
files.first { $0.absoluteUrl == withOutputPath }
}
}