|
@@ -100,8 +100,24 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|
|
shareItem.submenu = NSSharingServicePicker.menu(forSharingItems: [""], subjectContext: "", withTarget: self, selector: #selector(sharePageItemAction), serviceDelegate: nil)
|
|
|
}
|
|
|
|
|
|
- @objc func sharePageItemAction() {
|
|
|
+ @objc func sharePageItemAction(sender: NSMenuItem) {
|
|
|
+ if ((NSApp.mainWindow?.windowController is KMBrowserWindowController) == false) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let windowControler = NSApp.mainWindow?.windowController as! KMBrowserWindowController
|
|
|
+ let model: CTTabStripModel = windowControler.browser.tabStripModel
|
|
|
+ if (model.count() <= 0) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (model.activeTabContents().isHome) {
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ let document: KMMainDocument = model.activeTabContents() as! KMMainDocument
|
|
|
+ let represent : NSSharingService = sender.representedObject as! NSSharingService
|
|
|
+ represent.perform(withItems: [document.fileURL as Any])
|
|
|
}
|
|
|
|
|
|
func updateAccountMenus() {
|