|
@@ -425,15 +425,26 @@ import Cocoa
|
|
|
|
|
|
override func openDocument(_ sender: Any!) {
|
|
|
guard let _window = self.window else {
|
|
|
+ KMPrint("openDocument error: window is nil.", beep: true)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- NSOpenPanel.km_open_pdf_multi_success(_window, panel: nil) { urls in
|
|
|
+ NSOpenPanel.km_open_multi_success(_window) { panel in
|
|
|
+ panel.allowedFileTypes = KMTools.imageExtensions + KMTools.pdfExtensions
|
|
|
+ } completion: { urls in
|
|
|
+ var imageUrls: [URL] = []
|
|
|
for url in urls {
|
|
|
- NSDocumentController.shared.km_safe_openDocument(withContentsOf: url, display: true) { _, _, _ in
|
|
|
-
|
|
|
+ if KMTools.isPDFType(url.pathExtension.lowercased()) {
|
|
|
+ NSDocumentController.shared.km_safe_openDocument(withContentsOf: url, display: true) { _, _, _ in
|
|
|
+
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ imageUrls.append(url)
|
|
|
}
|
|
|
}
|
|
|
+ if imageUrls.isEmpty == false {
|
|
|
+ NSApplication.ShowImageToPDFWindow(urls: imageUrls)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|