Browse Source

【综合】页面编辑 插入-自定义页面,页面位置需要默认勾选第三个选项(已修复)

tangchao 1 year ago
parent
commit
58f087dbc2

+ 9 - 3
PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift

@@ -461,10 +461,14 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
         
         // 在当前选中item之后插入
         // 多选时,则取最后一页
-        for indexpath in self.thumbnailView.selectionIndexPaths.sorted() {
-            index = indexpath.item
+//        for indexpath in self.thumbnailView.selectionIndexPaths.sorted() {
+//            index = indexpath.item
+//        }
+        let indexpaths = self.thumbnailView.selectionIndexPaths.sorted()
+        if  indexpaths.isEmpty {
+            return self.listView?.currentPageIndex ?? 0
         }
-        return index
+        return indexpaths.first!.item
     }
     
     override func splitAction() {
@@ -902,6 +906,8 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
         }
         
         let windowC = KMPDFEditInsertBlankPageWindow(document: self.pdfDocument!)
+        windowC.currentPage = self.getSelecteIndex() + 1
+        windowC.insertLocation = 3
         windowC.callback = { [weak self] pdfDoc, _, pages, insertI in
             if let _pages = pages {
 //                self?.insertPages(pages: _pages, at: IndexSet(integer: insertI+1))

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/PageEdit/Window/KMPDFEditInsertBlankPageWindow.swift

@@ -59,7 +59,7 @@ class KMPDFEditInsertBlankPageWindow: NSWindowController {
         self.init(windowNibName: "KMPDFEditInsertBlankPageWindow")
         
         //        self.type = KMPDFEditManagement;
-        self.currentPage = 1;
+        self.currentPage = 1
         self.pdfDocument = CPDFDocument(url: documentPath)
     }
     

+ 5 - 5
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/Base/KMPDFThumbViewBaseController.swift

@@ -578,11 +578,11 @@ class KMPDFThumbViewBaseController: KMBaseViewController {
             return NSNotFound
         }
         
-        var index: Int = 0
-        for indexpath in self.thumbnailView.selectionIndexPaths {
-            index = indexpath.item
-        }
-        return index
+//        var index: Int = 0
+//        for indexpath in self.thumbnailView.selectionIndexPaths {
+//            index = indexpath.item
+//        }
+        return self.thumbnailView.selectionIndexPaths.first?.item ?? 0
     }
     
     // MARK: - Private Methods