From 34e9ca9493b0af522a65b7afe5192dad9085edb1 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 8 Dec 2022 15:49:54 +0800 Subject: [PATCH] PhraseEditor // Allow calling TextEdit if the option key is pressed. --- .../Sources/PhraseEditorUI/PhraseEditorUI.swift | 3 ++- .../Modules/WindowControllers/CtlPrefWindow_PhraseEditor.swift | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Packages/vChewing_PhraseEditorUI/Sources/PhraseEditorUI/PhraseEditorUI.swift b/Packages/vChewing_PhraseEditorUI/Sources/PhraseEditorUI/PhraseEditorUI.swift index 9e3df143..907ae0c2 100644 --- a/Packages/vChewing_PhraseEditorUI/Sources/PhraseEditorUI/PhraseEditorUI.swift +++ b/Packages/vChewing_PhraseEditorUI/Sources/PhraseEditorUI/PhraseEditorUI.swift @@ -187,7 +187,8 @@ public struct VwrPhraseEditorUI: View { } private func callExternalAppToOpenPhraseFile() { - delegate?.openPhraseFile(mode: selInputMode, type: selUserDataType, app: "Finder") + let app: String = NSEvent.modifierFlags.contains(.option) ? "TextEdit" : "Finder" + delegate?.openPhraseFile(mode: selInputMode, type: selUserDataType, app: app) } // MARK: - Main View. diff --git a/Source/Modules/WindowControllers/CtlPrefWindow_PhraseEditor.swift b/Source/Modules/WindowControllers/CtlPrefWindow_PhraseEditor.swift index 3349f09d..e0f47e6f 100644 --- a/Source/Modules/WindowControllers/CtlPrefWindow_PhraseEditor.swift +++ b/Source/Modules/WindowControllers/CtlPrefWindow_PhraseEditor.swift @@ -190,7 +190,8 @@ extension CtlPrefWindow: NSTextViewDelegate, NSTextFieldDelegate { @IBAction func openExternallyPEButtonClicked(_: NSButton) { DispatchQueue.main.async { [self] in - LMMgr.shared.openPhraseFile(mode: selInputMode, type: selUserDataType, app: "Finder") + let app: String = NSEvent.modifierFlags.contains(.option) ? "TextEdit" : "Finder" + LMMgr.shared.openPhraseFile(mode: selInputMode, type: selUserDataType, app: app) } }