Ver Fonte

[保存] - 保存动画 & 注释列表,获取markup注释

liujiajie há 6 meses atrás
pai
commit
2200c2d0b8

+ 1 - 0
PDF Office/PDF Master/Class/AutoSave/Tools/AutoSaveManager.swift

@@ -31,6 +31,7 @@ public let KAutoSaveTimeValueChangedNoti = "KAutoSaveTimeValueChangedNoti"
     var autoSaveDidEndAction = false
     // /当前是否正在保存
     var isSaving = false
+    var isSaveNoti = false
     
     private var _autoSaveFolder: String = ""
     var autoSaveFolder: String {

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/AppKitCategories/CPDFListAnnotationNoteWindowController.swift

@@ -166,7 +166,7 @@ class CPDFListAnnotationNoteWindowController: KMBaseWindowController {
             } else if keyPath == "markupText" {
                 synchronizeWindowTitleWithDocumentName()
                 if let note = self.note as? CPDFMarkupAnnotation {
-                    contentTextView.string = note.markupText()
+                    contentTextView.string = note.markupText() ?? ""
                 }
             }
         } else {

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/KMAnnotationTool/KMBOTAAnnotationTool.swift

@@ -115,7 +115,7 @@ class KMBOTAAnnotationTool: NSObject {
         if annotation.contents != nil {
             contentString = annotation.contents
             if annotation.isKind(of: CPDFMarkupAnnotation.self) {
-                var markupString: String = (annotation as! CPDFMarkupAnnotation).markupText()
+                var markupString: String = (annotation as! CPDFMarkupAnnotation).markupText() ?? ""
                 contentString = contentString.replacingOccurrences(of: " ", with: "")
                 markupString = markupString.replacingOccurrences(of: " ", with: "")
                 

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/KMAnnotationViewController.swift

@@ -438,7 +438,7 @@ extension KMAnnotationViewController {
                     let item: CPDFMarkupAnnotation = annotationItem.annotation! as? CPDFMarkupAnnotation ?? CPDFMarkupAnnotation()
                     if item.markupText() != nil {
                         KMPrint(item.markupText() as Any)
-                        content = content + "\n" + item.markupText()
+                        content = content + "\n" + (item.markupText() ?? "")
                     }
 
                     let pasteBoard = NSPasteboard.general

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMAnnotationTableCellView.swift

@@ -176,10 +176,10 @@ class KMAnnotationTableCellView: NSTableCellView {
         
         var contentString = annotation.contents
         if annotation.isKind(of: CPDFMarkupAnnotation.self) {
-            contentString = (annotation as! CPDFMarkupAnnotation).markupText()
+            contentString = (annotation as! CPDFMarkupAnnotation).markupText() ?? ""
         }
         if contentString != nil && contentString != "" {
-            if contentString!.count > 0 {
+            if contentString?.count ?? 0 > 0 {
                 let height = KMBOTAAnnotationTool.fetchTextHeight(string: contentString!, maxSize: NSSize(width: 188, height: 300))
                 self.contentBGHeightConst.constant = height + 8
             }

+ 3 - 1
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -2410,6 +2410,7 @@ extension KMMainViewController {
         if AutoSaveManager.manager.isSaving{
             return
         }
+        AutoSaveManager.manager.isSaveNoti = true
         var num = 0
         if self.listView.document != nil{
             num = Int(self.listView.document.pageCount)
@@ -2424,9 +2425,10 @@ extension KMMainViewController {
     }
     
     func pdfSaveFinishAlertView(_ sender: NSNotification) {
-        if AutoSaveManager.manager.isSaving{
+        if !AutoSaveManager.manager.isSaveNoti{
             return
         }
+        AutoSaveManager.manager.isSaveNoti = false
         if Thread.current.isMainThread {
             self.dismissProgressSheet()
         } else {

+ 3 - 4
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -1504,13 +1504,12 @@ import Cocoa
             DispatchQueue.main.asyncAfter(deadline: .now()+0.1) {
                 // 隐藏进度
                 self.hiddenProgressWindow()
-                
+                DispatchQueue.main.asyncAfter(deadline: .now()+1) {
+                    AutoSaveManager.manager.isSaving = false
+                }
                 // 回调
                 callback()
             }
-            DispatchQueue.main.asyncAfter(deadline: .now()+1) {
-                AutoSaveManager.manager.isSaving = false
-            }
         }
     }
     func SaveTempPDFDocumentToURLPath(tempPath: String) {