Browse Source

【综合】无法添加文本问题修正,添加便签自动激活输入框逻辑处理

niehaoyu 9 months ago
parent
commit
d0cbf9948a

+ 6 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/AppKitCategories/CPDFListEditAnnotationViewController.swift

@@ -140,6 +140,12 @@ class CPDFListEditAnnotationViewController: NSViewController, NSTextViewDelegate
         
         self.contentLabel?.stringValue = content
         self.contentTextView?.delegate = self
+        
+        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()+0.15) {
+            self.view.window?.makeFirstResponder(self.contentTextView)
+            
+            self.contentTextView?.string = self.annotation.contents ?? ""
+        }
     }
     
     func undoManager(for view: NSTextView) -> UndoManager? {

+ 4 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -223,7 +223,10 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
             [self doFormWithEvent:theEvent];
         } else {
             [self doDragAddAnnotationWithEvent:theEvent];
-            [super mouseDown:theEvent];
+            if (self.annotationType == CAnnotationTypeStamp ||
+                self.annotationType == CAnnotationTypeSignSignature) {
+                [super mouseDown:theEvent];
+            }
         }
     } else if ([self isSupportSelectAnnotation] && (area & CPDFImageArea) && CAnnotationTypeUnkown == self.annotationType) {
         [self updateActiveAnnotations:@[]];