Skip to content

Commit

Permalink
merge CodeEditApp#1822 fix into this branch
Browse files Browse the repository at this point in the history
allow files with a utType that is neither image nor PDF to be previewed (CodeEditApp#1822)
  • Loading branch information
plbstl committed Aug 19, 2024
1 parent 34b9afc commit 86fccc0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions CodeEdit/Features/Editor/Views/NonTextFileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ struct NonTextFileView: View {
var body: some View {
Group {
if let fileURL = fileDocument.fileURL {
Group {
if let utType = fileDocument.utType {
if utType.conforms(to: .image) {
ImageFileView(fileURL)
} else if utType.conforms(to: .pdf) {
PDFFileView(fileURL)
}

if let utType = fileDocument.utType {
if utType.conforms(to: .image) {
ImageFileView(fileURL)
} else if utType.conforms(to: .pdf) {
PDFFileView(fileURL)
} else {
AnyFileView(fileURL)
}
} else {
AnyFileView(fileURL)
}

} else {
ZStack {
Text("Cannot retrieve URL to the file you opened.")
Expand Down

0 comments on commit 86fccc0

Please sign in to comment.