Skip to content

Commit b5e3261

Browse files
committed
Added support for kml and toml languages. Highlight upgraded to 3.60.
1 parent 0d0b674 commit b5e3261

File tree

21 files changed

+526
-117
lines changed

21 files changed

+526
-117
lines changed

Application/AppearanceView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class AppearanceView: NSView {
155155
btn?.wantsLayer = true
156156
btn?.layer?.cornerRadius = 8
157157
btn?.layer?.borderWidth = 1
158-
btn?.layer?.borderColor = NSColor.gridColor.cgColor
158+
btn?.layer?.borderColor = NSColor.tertiaryLabelColor.cgColor
159159
}
160160
}
161161

Application/Base.lproj/Main.storyboard

Lines changed: 26 additions & 24 deletions
Large diffs are not rendered by default.

Application/Info.plist

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<key>LSMinimumSystemVersion</key>
3838
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
3939
<key>NSHumanReadableCopyright</key>
40-
<string>Copyright © 2020 SBAREX. All rights reserved.</string>
40+
<string>Copyright © 2019-2021 SBAREX. All rights reserved.</string>
4141
<key>NSMainStoryboardFile</key>
4242
<string>Main</string>
4343
<key>NSPrincipalClass</key>
@@ -51,7 +51,7 @@
5151
<key>SUPublicEDKey</key>
5252
<string>J+ikFQXeR6eaUV0jvyfZAJKeYh+9UKGJuD/kJSIXnZk=</string>
5353
<key>SUScheduledCheckInterval</key>
54-
<integer>86400</integer>
54+
<real>86400</real>
5555
<key>UTExportedTypeDeclarations</key>
5656
<array>
5757
<dict>
@@ -1578,6 +1578,29 @@
15781578
</array>
15791579
</dict>
15801580
</dict>
1581+
<dict>
1582+
<key>UTTypeConformsTo</key>
1583+
<array>
1584+
<string>public.xml</string>
1585+
</array>
1586+
<key>UTTypeDescription</key>
1587+
<string>Google Earth KML Document</string>
1588+
<key>UTTypeIdentifier</key>
1589+
<string>com.google.earth.kml</string>
1590+
<key>UTTypeReferenceURL</key>
1591+
<string>http://earth.google.com/kml/</string>
1592+
<key>UTTypeTagSpecification</key>
1593+
<dict>
1594+
<key>com.apple.ostype</key>
1595+
<string>GKml</string>
1596+
<key>public.filename-extension</key>
1597+
<array>
1598+
<string>kml</string>
1599+
</array>
1600+
<key>public.mime-type</key>
1601+
<string>application/vnd.google-earth.kml+xml</string>
1602+
</dict>
1603+
</dict>
15811604
<dict>
15821605
<key>UTTypeConformsTo</key>
15831606
<array>
Binary file not shown.
Binary file not shown.

Application/ThemeCollectionViewItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ThemeCollectionViewItem: NSCollectionViewItem {
1515
imageView?.layer?.cornerRadius = 8
1616
imageView?.layer?.masksToBounds = true
1717
imageView?.layer?.borderWidth = 1
18-
imageView?.layer?.borderColor = NSColor.gridColor.cgColor
18+
imageView?.layer?.borderColor = NSColor.tertiaryLabelColor.cgColor
1919
}
2020

2121
var theme: SCSHThemePreview? {

Application/ThemesViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ class ThemeTableCellView: NSTableCellView {
10161016
// Round the image.
10171017
imageView?.layer?.cornerRadius = 8
10181018
imageView?.layer?.masksToBounds = true
1019-
imageView?.layer?.borderColor = NSColor.gridColor.cgColor
1019+
imageView?.layer?.borderColor = NSColor.tertiaryLabelColor.cgColor
10201020
imageView?.layer?.borderWidth = 1
10211021
}
10221022
}

CHANGELOG.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
1.0.b31
2+
New features:
3+
- Support for Google `kml` files (rendered as `xml`).
4+
- Support for `toml` language.
5+
- `highlight` updated to version 3.60.
6+
7+
Bugfix:
8+
- Temporary fix to the webkit bug on Big Sur.
9+
110
1.0.b30
211
New features:
312
- Auto update with Sparkle framework. Auto updated works only when run the main application and not from the quicklook extension. You must have launched the application at least twice for the update checks to begin, or you can use the appropriate item in the application menu.

QLExtension/Info.plist

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<string>com.dhowett.logos</string>
5151
<string>com.eiffel.eiffelstudio-project-config</string>
5252
<string>com.eiffel.source-code</string>
53+
<string>com.google.earth.kml</string>
5354
<string>com.jetbrain.source</string>
5455
<string>com.macromates.textmate.scheme</string>
5556
<string>com.macromates.textmate.standard-ml</string>
@@ -186,6 +187,7 @@
186187
<string>dyn.ah62d4rv4ge81k3p2</string>
187188
<string>dyn.ah62d4rv4ge81a8p</string>
188189
<string>dyn.ah62d4rv4ge81g6pq</string>
190+
<string>dyn.ah62d4rv4ge81k55rru</string>
189191
<string>dyn.ah62d46dzqm0gw23stb002svvhz6g45a</string>
190192
</array>
191193
<key>QLSupportsSearchableItems</key>
@@ -197,6 +199,6 @@
197199
<string>$(PRODUCT_MODULE_NAME).PreviewViewController</string>
198200
</dict>
199201
<key>NSHumanReadableCopyright</key>
200-
<string>Copyright © 2019 SBAREX. All rights reserved.</string>
202+
<string>Copyright © 2019-2021 SBAREX. All rights reserved.</string>
201203
</dict>
202204
</plist>

QLExtension/PreviewViewController.swift

Lines changed: 42 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -239,59 +239,52 @@ class PreviewViewController: NSViewController, QLPreviewingController, WKNavigat
239239
}
240240
self.handler = handler
241241

242-
if #available(macOS 11, *) {
243-
// On BigSur 11.0.1 the entitlements on the extesion are ignored and webkit fail to render. Old WebView works.
244-
let webView = WebView(frame: previewRect)
245-
webView.autoresizingMask = [.height, .width]
246-
webView.preferences.isJavaScriptEnabled = false
247-
webView.preferences.allowsAirPlayForMediaPlayback = false
248-
webView.preferences.arePlugInsEnabled = false
249-
250-
if let v = settings[SCSHSettings.Key.interactive] as? Bool, v {
251-
webView.preferences.isJavaScriptEnabled = true
252-
}
253-
254-
self.view.addSubview(webView)
255-
webView.mainFrame.loadHTMLString(html, baseURL: nil)
256-
webView.frameLoadDelegate = self
257-
} else {
258-
let preferences = WKPreferences()
259-
preferences.javaScriptEnabled = false
260-
if let v = settings[SCSHSettings.Key.interactive] as? Bool, v {
261-
preferences.javaScriptEnabled = true
262-
}
242+
let preferences = WKPreferences()
243+
preferences.javaScriptEnabled = false
244+
if let v = settings[SCSHSettings.Key.interactive] as? Bool, v {
245+
preferences.javaScriptEnabled = true
246+
}
263247

264-
// Create a configuration for the preferences
265-
let configuration = WKWebViewConfiguration()
266-
//configuration.preferences = preferences
267-
configuration.allowsAirPlayForMediaPlayback = false
268-
// configuration.userContentController.add(self, name: "jsHandler")
269-
270-
let webView: WKWebView
271-
if let v = settings[SCSHSettings.Key.interactive] as? Bool, v {
272-
webView = WKWebView(frame: previewRect, configuration: configuration)
273-
} else {
274-
webView = StaticWebView(frame: previewRect, configuration: configuration)
275-
(webView as! StaticWebView).fileUrl = self.fileUrl
276-
}
277-
webView.autoresizingMask = [.height, .width]
278-
279-
webView.wantsLayer = true
280-
if #available(macOS 11, *) {
281-
webView.layer?.borderWidth = 0
282-
} else {
283-
// Draw a border around the web view
284-
webView.layer?.borderColor = NSColor.gridColor.cgColor
285-
webView.layer?.borderWidth = 1
286-
}
287-
288-
webView.navigationDelegate = self
289-
webView.uiDelegate = self
248+
// Create a configuration for the preferences
249+
let configuration = WKWebViewConfiguration()
250+
//configuration.preferences = preferences
251+
configuration.allowsAirPlayForMediaPlayback = false
252+
// configuration.userContentController.add(self, name: "jsHandler")
290253

254+
/* MARK: FIXME
255+
On Big Sur as far as I know, QuickLook extensions don't honor com.apple.security.network.client, so WebKit process immediately crash.
256+
To temporary fix add this entitlements exception
257+
com.apple.security.temporary-exception.mach-lookup.global-name:
258+
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
259+
<array>
260+
<string>com.apple.nsurlsessiond</string>
261+
</array>
262+
*/
291263

292-
webView.loadHTMLString(html, baseURL: nil)
293-
self.view.addSubview(webView)
264+
let webView: WKWebView
265+
if let v = settings[SCSHSettings.Key.interactive] as? Bool, v {
266+
webView = WKWebView(frame: previewRect, configuration: configuration)
267+
} else {
268+
webView = StaticWebView(frame: previewRect, configuration: configuration)
269+
(webView as! StaticWebView).fileUrl = self.fileUrl
294270
}
271+
webView.autoresizingMask = [.height, .width]
272+
273+
webView.wantsLayer = true
274+
if #available(macOS 11, *) {
275+
webView.layer?.borderWidth = 0
276+
} else {
277+
// Draw a border around the web view
278+
webView.layer?.borderColor = NSColor.tertiaryLabelColor.cgColor
279+
webView.layer?.borderWidth = 1
280+
}
281+
282+
webView.navigationDelegate = self
283+
webView.uiDelegate = self
284+
285+
286+
webView.loadHTMLString(html, baseURL: nil)
287+
self.view.addSubview(webView)
295288
// handler(nil) // call the handler in the delegate method after complete rendering
296289
}
297290
}
@@ -368,20 +361,3 @@ extension PreviewViewController: WKScriptMessageHandler {
368361

369362
extension PreviewViewController: WKUIDelegate {
370363
}
371-
372-
@available(macOS, deprecated: 10.14)
373-
extension PreviewViewController: WebFrameLoadDelegate {
374-
func webView(_ sender: WebView!, didFinishLoadFor frame: WebFrame!) {
375-
if let handler = self.handler {
376-
handler(nil)
377-
}
378-
self.handler = nil
379-
}
380-
func webView(_ sender: WebView!, didFailLoadWithError error: Error!, for frame: WebFrame!) {
381-
if let handler = self.handler {
382-
handler(error)
383-
}
384-
self.handler = nil
385-
}
386-
}
387-

0 commit comments

Comments
 (0)