PhraseEditor // Release some memory when it gets disappeared.

This commit is contained in:
ShikiSuen 2022-12-09 22:16:41 +08:00
parent ac6b53b3ec
commit d2107f847a
2 changed files with 9 additions and 2 deletions

View File

@ -297,6 +297,8 @@ public struct VwrPhraseEditorUI: View {
selInputMode = .imeModeNULL
selUserDataType = .thePhrases
txtContent = NSLocalizedString("Please select Simplified / Traditional Chinese mode above.", comment: "")
isLoading = true
Self.txtContentStorage = ""
}.onAppear {
guard let delegate = delegate else { return }
selInputMode = delegate.currentInputMode

View File

@ -28,7 +28,7 @@ extension NSToolbarItem.Identifier {
// only works with macOS System Preference pane (like macOS built-in input methods).
// It should be set as "Preferences" which correspondes to the "Preference" pref pane
// of this build target.
class CtlPrefWindow: NSWindowController {
class CtlPrefWindow: NSWindowController, NSWindowDelegate {
@IBOutlet var fontSizePopUpButton: NSPopUpButton!
@IBOutlet var uiLanguageButton: NSPopUpButton!
@IBOutlet var basicKeyboardLayoutButton: NSPopUpButton!
@ -66,8 +66,9 @@ class CtlPrefWindow: NSWindowController {
public static var shared: CtlPrefWindow?
static func show() {
if shared == nil { shared = CtlPrefWindow(windowNibName: "frmPrefWindow") }
shared = CtlPrefWindow(windowNibName: "frmPrefWindow")
guard let sharedWindow = shared?.window else { return }
sharedWindow.delegate = shared
sharedWindow.center()
sharedWindow.orderFrontRegardless() //
sharedWindow.level = .statusBar
@ -174,6 +175,10 @@ class CtlPrefWindow: NSWindowController {
initPhraseEditor()
}
func windowWillClose(_: Notification) {
tfdPETextEditor.string = ""
}
// CNS
//
@IBAction func toggleCNSSupport(_: Any) {