Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow files with a utType that is neither image nor PDF to be previewed #1822

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CodeEdit/Features/Editor/Views/NonTextFileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ struct NonTextFileView: View {
@EnvironmentObject private var statusBarViewModel: StatusBarViewModel

var body: some View {

Group {
if let fileURL = fileDocument.fileURL {
if let utType = fileDocument.utType {
Expand All @@ -32,12 +31,15 @@ struct NonTextFileView: View {
} else if utType.conforms(to: .pdf) {
PDFFileView(fileURL)
.modifier(UpdateStatusBarInfo(withURL: fileURL))
} else {
AnyFileView(fileURL)
.modifier(UpdateStatusBarInfo(withURL: fileURL))
}

austincondiff marked this conversation as resolved.
Show resolved Hide resolved
} else {
AnyFileView(fileURL)
.modifier(UpdateStatusBarInfo(withURL: fileURL))
}

} else {
ZStack {
Text("Cannot retrieve URL to the file you opened.")
Expand All @@ -48,6 +50,5 @@ struct NonTextFileView: View {
statusBarViewModel.dimensions = nil
statusBarViewModel.fileSize = nil
}

}
}
Loading