Browse Source

【左边栏】- 添加书签打开左边栏并进入编辑状态

liaoxiaoyue 1 năm trước cách đây
mục cha
commit
2c06ce7f8d

+ 14 - 5
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/BookMarks/KMBookMarkViewController.swift

@@ -65,14 +65,23 @@ class KMBookMarkViewController: NSViewController, NSTextFieldDelegate,NSMenuItem
         self.bookTableView.reloadData()
     }
     
+    func addBookMarkAndEdit(newBookMark:CPDFBookmark) {
+        self.reloadData()
+        if self.dataSource.contains(newBookMark) {
+            if let index = self.dataSource.firstIndex(of: newBookMark) {
+                self.selectRow(index: index)
+                self.renameBookWithRow(row: index)
+            }
+        }
+    }
+    
     func selectRow(index:NSInteger) {
         self.bookTableView.deselectAll(nil)
         
-        if index > 0 {
-            var indexSet = IndexSet()
-            indexSet.insert(index)
-            self.bookTableView.selectRowIndexes(indexSet, byExtendingSelection: false)
-        }
+        var indexSet = IndexSet()
+        indexSet.insert(index)
+        self.bookTableView.selectRowIndexes(indexSet, byExtendingSelection: false)
+        
     }
     
     func initNotification() {