Browse Source

【fix】【注释】添加超链接的时候,应该禁止粘贴换行

tangchao 5 months ago
parent
commit
4694e1e7b8

+ 12 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift

@@ -1534,11 +1534,20 @@ extension KMLeftSideViewController {
         guard let data = annos else {
             return false
         }
-//        for anno in data {
+        
+        var need = false
+        for anno in data {
 //            if anno.isKind(of: KMTableAnnotation.self) == false {
 //                return true
 //            }
-//        }
-        return true
+            if anno.isForm() {
+                continue
+            }
+            if anno is CPDFLinkAnnotation {
+                continue
+            }
+            need = true
+        }
+        return need
     }
 }

+ 6 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationSelectLinkViewController.swift

@@ -583,13 +583,15 @@ enum KMAnnotationLinkType: UInt {
     
     @objc func controlTextDidChange(_ notification: Notification) {
         guard let textField = notification.object as? NSTextField else { return }
-
+        
+        let string = textField.stringValue.replacingOccurrences(of: "\n", with: "")
+        textField.stringValue = string
         if mouseDownBox!.isEqual(linkPageBox) {
-            pageRecord = textField.stringValue
+            pageRecord = string
         } else if mouseDownBox!.isEqual(linkUrlBox) {
-            urlRecord = textField.stringValue
+            urlRecord = string
         } else if mouseDownBox!.isEqual(linkEmailBox) {
-            emailRecord = textField.stringValue
+            emailRecord = string
         }
 
         if linkType == KMAnnotationLinkType.page {