Parcourir la source

【左边栏】- 大纲列表添加上一级无效,进入编辑状态效果处理

liaoxiaoyue il y a 1 an
Parent
commit
a032b15a20

+ 6 - 2
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/Outline/KMOutlineViewController.swift

@@ -208,8 +208,9 @@ class KMOutlineViewController: NSViewController,NSMenuItemValidation {
             __NSBeep()
         } else {
             let currentPDFOutline  = self.outlineView.item(atRow: selectedRowIndexes.last!) as! CPDFOutline
-            let parent = currentPDFOutline.parent
+            var parent = currentPDFOutline.parent
             let index = NSInteger(parent!.index) + 1
+            parent = parent?.parent
             if parent != nil {
                 self.addPDFOutlineToIndex(index: index, atParent: parent)
             } else {
@@ -320,10 +321,10 @@ class KMOutlineViewController: NSViewController,NSMenuItemValidation {
     }
     
     func renamePDFOutline(outline : CPDFOutline! , label:String) {
+        self.renameTextField.isEditable = false
         if outline.label == label {
             return
         }
-        
         outline.label = label
         self.outlineView.reloadData()
         
@@ -390,6 +391,9 @@ class KMOutlineViewController: NSViewController,NSMenuItemValidation {
         for i in 0..<numRows {
             let tPDFOutline = self.outlineView.item(atRow: i) as! CPDFOutline
             let tPage = tPDFOutline.destination.pageIndex
+            if tPage < 0 {
+                continue
+            }
             var page = self.listView.document.page(at: UInt(tPage))!
             var tDict : [String : CPDFPage] = ["\(i)":page]
             arr.append(tDict)