|
@@ -273,8 +273,13 @@ extension KMMainViewController {
|
|
|
}
|
|
|
|
|
|
func addBookmarkMenu() -> NSMenuItem {
|
|
|
- let bookMarkItem = NSMenuItem(title: NSLocalizedString("Add BookMark", comment: ""), action: #selector(menuItemBookMarkClick_add), target: self)!
|
|
|
- return bookMarkItem
|
|
|
+ if self.listView.document.bookmark(forPageIndex: UInt(self.listView.currentPageIndex)) == nil {
|
|
|
+ let bookMarkItem = NSMenuItem(title: NSLocalizedString("Add BookMark", comment: ""), action: #selector(menuItemBookMarkClick_add), target: self)!
|
|
|
+ return bookMarkItem
|
|
|
+ } else {
|
|
|
+ let bookMarkItem = NSMenuItem(title: NSLocalizedString("Remove BookMark", comment: ""), action: #selector(menuItemBookMarkClick_add), target: self)!
|
|
|
+ return bookMarkItem
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func findStringMenu() -> NSMenuItem {
|
|
@@ -499,8 +504,16 @@ extension KMMainViewController {
|
|
|
self.listView.document.removeBookmark(forPageIndex: UInt(self.listView.currentPageIndex))
|
|
|
self.listView.setNeedsDisplayForVisiblePages()
|
|
|
}
|
|
|
- self.leftSideViewController.refreshMethodType(methodType: .BookMark)
|
|
|
- self.leftSideViewController.bookViewController.reloadData()
|
|
|
+ if self.leftPanelOpen == false || self.leftSideViewController.type.methodType != .BookMark {
|
|
|
+ self.leftSideViewController.refreshMethodType(methodType: .BookMark)
|
|
|
+ }
|
|
|
+ let bookMark = self.listView.document.bookmark(forPageIndex: UInt(self.listView.currentPageIndex))
|
|
|
+ if bookMark != nil {
|
|
|
+ self.leftSideViewController.bookViewController.addBookMarkAndEdit(newBookMark: bookMark!)
|
|
|
+ } else {
|
|
|
+ self.leftSideViewController.bookViewController.reloadData()
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@objc func menuItemAnnotationClick_FindString(sender:NSMenuItem) {
|