From 63bdc53b13cb5aff6c226467e235fd81dd64f69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orkun=20=C5=9Eensebat?= Date: Wed, 28 Jan 2026 14:02:46 +0100 Subject: [PATCH] Fix Cmd+C copy in Quick Look preview Allow WKWebView to become first responder and use the view-based preview path instead of the data-based path. This enables keyboard shortcuts including Cmd+C to work in the Quick Look preview. Previously, MyWKWebView explicitly returned false for canBecomeKeyView and becomeFirstResponder, which blocked all keyboard input. Additionally, with QLIsDataBasedPreview=true, macOS 12+ used the providePreview method which doesn't use the WKWebView at all, giving us no control over keyboard handling. By setting QLIsDataBasedPreview=false and allowing the WebView to become first responder, Quick Look now uses preparePreviewOfFile with our WKWebView, and Cmd+C works correctly. Fixes #177 --- QLExtension/Info.plist | 2 +- QLExtension/PreviewViewController.swift | 5 ++--- cmark-gfm | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/QLExtension/Info.plist b/QLExtension/Info.plist index e1464ec0..58303ff3 100644 --- a/QLExtension/Info.plist +++ b/QLExtension/Info.plist @@ -27,7 +27,7 @@ NSExtensionAttributes QLIsDataBasedPreview - + QLSupportedContentTypes com.unknown.md diff --git a/QLExtension/PreviewViewController.swift b/QLExtension/PreviewViewController.swift index 5f18bc02..39abd295 100644 --- a/QLExtension/PreviewViewController.swift +++ b/QLExtension/PreviewViewController.swift @@ -13,12 +13,11 @@ import external_launcher class MyWKWebView: WKWebView { override var canBecomeKeyView: Bool { - return false + return true } override func becomeFirstResponder() -> Bool { - // Quick Look window do not allow first responder child. - return false + return true } } diff --git a/cmark-gfm b/cmark-gfm index c168d57a..587a12bb 160000 --- a/cmark-gfm +++ b/cmark-gfm @@ -1 +1 @@ -Subproject commit c168d57acfa1f688e519e4e829f9a28d559bd5fa +Subproject commit 587a12bb54d95ac37241377e6ddc93ea0e45439b