|
@@ -1714,9 +1714,16 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
|
|
|
return 0
|
|
|
}
|
|
|
if item == nil { // 第一层
|
|
|
+ let bks = self.bookmarks() ?? []
|
|
|
+ let bkNum = bks.isEmpty ? 0 : 1
|
|
|
+
|
|
|
guard let rootOL = self.outlineRoot() else {
|
|
|
- self.showOutlineEmptyView()
|
|
|
- return 0
|
|
|
+ if bkNum > 0 {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ self.showOutlineEmptyView()
|
|
|
+ }
|
|
|
+ return 0 + bkNum
|
|
|
}
|
|
|
// 搜索按钮
|
|
|
self.outlineSearchButton.isEnabled = rootOL.numberOfChildren > 0
|
|
@@ -1732,14 +1739,16 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
|
|
|
}
|
|
|
|
|
|
if rootOL.numberOfChildren == 0 { // 没有数据
|
|
|
- self.showOutlineEmptyView()
|
|
|
- return 0
|
|
|
+ if bkNum > 0 {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ self.showOutlineEmptyView()
|
|
|
+ }
|
|
|
+ return 0 + bkNum
|
|
|
}
|
|
|
|
|
|
// 有数据
|
|
|
self.hideOutlineEmptyView()
|
|
|
- let bks = self.bookmarks() ?? []
|
|
|
- let bkNum = bks.isEmpty ? 0 : 1
|
|
|
return Int(rootOL.numberOfChildren) + bkNum
|
|
|
} else { // 第二层 +
|
|
|
if item is CPDFBookmark { // 书签
|
|
@@ -2060,7 +2069,17 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
|
|
|
if dragPDFOL.index > index {
|
|
|
self.dragPDFOutline(self._dragPDFOutline, toIndex: index, newParentOutline: root)
|
|
|
} else {
|
|
|
- self.dragPDFOutline(self._dragPDFOutline, toIndex: index-1, newParentOutline: root)
|
|
|
+ if let bks = self.bookmarks(), bks.count > 0 {
|
|
|
+ if let data = item as? String, data == Self.kOutlineRootBookmarkItem {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if index > 1 {
|
|
|
+ self.dragPDFOutline(self._dragPDFOutline, toIndex: index-2, newParentOutline: root)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ self.dragPDFOutline(self._dragPDFOutline, toIndex: index-1, newParentOutline: root)
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
self.dragPDFOutline(self._dragPDFOutline, toIndex: index, newParentOutline: root)
|