|
@@ -286,6 +286,20 @@ class KMPDFEditToolbar: NSView {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @objc private func _extractMenuItemAction(_ sender: NSMenuItem) {
|
|
|
+ if (sender.tag == 1) {
|
|
|
+ guard let callback = self.itemClick else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ callback(self, KMPageEditType.extract_selected_pages)
|
|
|
+ } else if (sender.tag == 2) {
|
|
|
+ guard let callback = self.itemClick else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ callback(self, KMPageEditType.extract.rawValue)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@objc func replaceMenuAction(sender: KMToolbarClickButton?) {
|
|
|
guard let callback = self.itemClick else {
|
|
|
return
|
|
@@ -513,9 +527,15 @@ extension KMPDFEditToolbar: KMToolbarViewDelegate {
|
|
|
item?.toolTip = NSLocalizedString("Exctract selected pages", comment: "")
|
|
|
item?.titleName = NSLocalizedString("Extract", comment: "")
|
|
|
item?.boxImagePosition = .imageExpandLeft
|
|
|
- item?.btnAction = #selector(extractMenuAction)
|
|
|
+// item?.btnAction = #selector(extractMenuAction)
|
|
|
+ item?.needExpandAction = true
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: "Extract", action: #selector(extractMenuAction), target: self)
|
|
|
+ let subMenu = NSMenu()
|
|
|
+ menuItem.submenu = subMenu
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Extract selected pages", comment: ""), action: #selector(_extractMenuItemAction) , target: self, tag: 1)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Extract", comment: ""), action: #selector(_extractMenuItemAction) , target: self, tag: 2)
|
|
|
+
|
|
|
item?.menuFormRepresentation = menuItem
|
|
|
} else if (identifier == KMToolbarPageEditReplaceItemIdentifier) {
|
|
|
item?.image = NSImage(named: KMImageNameToolbarReplace)
|