fix: dismiss active launcher window on Escape
This commit is contained in:
@@ -3,7 +3,7 @@ import ConjureKit
|
||||
import Security
|
||||
|
||||
@MainActor
|
||||
final class TranslationController: NSViewController, NSTextFieldDelegate, NSTextViewDelegate {
|
||||
final class TranslationController: NSViewController, NSTextFieldDelegate {
|
||||
private let keyField = NSSecureTextField()
|
||||
private let provider = NSPopUpButton()
|
||||
private let credentials = NSStackView()
|
||||
@@ -59,7 +59,7 @@ final class TranslationController: NSViewController, NSTextFieldDelegate, NSText
|
||||
translateButton.isBordered = false
|
||||
translateButton.font = .systemFont(ofSize: 12, weight: .medium)
|
||||
translateButton.contentTintColor = SunsetPalette.text
|
||||
translateButton.toolTip = "Translate the English input (Return). Escape returns to the launcher."
|
||||
translateButton.toolTip = "Translate the English input (Return). Escape dismisses Conjure."
|
||||
let returnKey = ShortcutIndicator("↵")
|
||||
let actionPill = NSView()
|
||||
actionPill.wantsLayer = true
|
||||
@@ -91,7 +91,6 @@ final class TranslationController: NSViewController, NSTextFieldDelegate, NSText
|
||||
output.textColor = SunsetPalette.text
|
||||
output.font = .systemFont(ofSize: 20)
|
||||
output.setAccessibilityLabel("Japanese translation")
|
||||
output.delegate = self
|
||||
let scroll = NSScrollView()
|
||||
scroll.documentView = output
|
||||
scroll.hasVerticalScroller = true
|
||||
@@ -129,20 +128,6 @@ final class TranslationController: NSViewController, NSTextFieldDelegate, NSText
|
||||
updateProvider()
|
||||
}
|
||||
|
||||
override func cancelOperation(_ sender: Any?) { goBack() }
|
||||
|
||||
func control(_ control: NSControl, textView: NSTextView, doCommandBy selector: Selector) -> Bool {
|
||||
guard selector == #selector(NSResponder.cancelOperation(_:)) else { return false }
|
||||
goBack()
|
||||
return true
|
||||
}
|
||||
|
||||
func textView(_ textView: NSTextView, doCommandBy selector: Selector) -> Bool {
|
||||
guard selector == #selector(NSResponder.cancelOperation(_:)) else { return false }
|
||||
goBack()
|
||||
return true
|
||||
}
|
||||
|
||||
func controlTextDidChange(_ notification: Notification) { inputChanged() }
|
||||
|
||||
@objc func goBack() {
|
||||
|
||||
Reference in New Issue
Block a user