Disable Publish menu item while publishing
This commit is contained in:
parent
81964d9ffa
commit
cb93c3874f
@ -7,12 +7,14 @@
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import Foundation
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
var vc: ViewController?
|
||||
|
||||
@IBOutlet weak var filePublishItem: NSMenuItem!
|
||||
@IBOutlet weak var nightModeItem: NSMenuItem!
|
||||
@IBOutlet weak var formatFontSerifItem: NSMenuItem!
|
||||
@IBOutlet weak var formatFontSansItem: NSMenuItem!
|
||||
@ -85,6 +87,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
|
||||
@IBAction func publishDoc(_ sender: Any) {
|
||||
filePublishItem.isEnabled = false
|
||||
vc?.publish()
|
||||
}
|
||||
|
||||
|
@ -368,6 +368,7 @@ DQ
|
||||
</application>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Write_as" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="filePublishItem" destination="Vdf-ed-k4A" id="TU2-UK-bgQ"/>
|
||||
<outlet property="formatFontMonoItem" destination="WRG-CD-K1S" id="919-ab-Ig1"/>
|
||||
<outlet property="formatFontSansItem" destination="Vjx-xi-njq" id="LIr-Ct-Ied"/>
|
||||
<outlet property="formatFontSerifItem" destination="GB9-OM-e27" id="rVW-JC-eyr"/>
|
||||
|
@ -110,6 +110,10 @@ class ViewController: NSViewController, NSTextViewDelegate, NSUserNotificationCe
|
||||
notification.informativeText = "The link is copied — press ⌘+V to share it."
|
||||
notification.soundName = NSUserNotificationDefaultSoundName
|
||||
|
||||
if let ad = NSApplication.shared().delegate as? AppDelegate {
|
||||
ad.filePublishItem.isEnabled = true
|
||||
}
|
||||
|
||||
NSUserNotificationCenter.default.deliver(notification)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user