Browse Source

【BOTA-注释】不要默认添加附注内容为注释文本 修复

lizhe 1 year ago
parent
commit
c4ac6845e3

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

@@ -55,8 +55,18 @@ static char CNoteWindowNoteObservationContext;
     self.contentTextView.delegate = self;
     
     self.note = note;
+    
     if ([self.note isKindOfClass:[CPDFMarkupAnnotation class]]) {
-        self.contentTextView.string = [(CPDFMarkupAnnotation *)self.note markupText]?:@"";
+        NSString *markupString = [(CPDFMarkupAnnotation *)self.note markupText];
+        NSString *contentString = self.note.contents;
+        
+        markupString = [markupString stringByReplacingOccurrencesOfString:@" " withString:@""];
+        contentString = [contentString stringByReplacingOccurrencesOfString:@" " withString:@""];
+        if ([markupString isEqualToString:contentString]) {
+            self.contentTextView.string = @"";
+        } else {
+            self.contentTextView.string = markupString;
+        }
     } else  {
         self.contentTextView.string = self.note.contents?:@"";
     }

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

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

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/KMAnnotationView/KMAnnotationOutlineView.xib

@@ -5,7 +5,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationOutlineView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationOutlineView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="outlineView" destination="Spv-Il-Vgj" id="Bd5-dH-DQB"/>
                 <outlet property="scrollView" destination="NPW-HZ-P2z" id="lEn-AC-LJv"/>
@@ -23,7 +23,7 @@
                         <rect key="frame" x="0.0" y="0.0" width="286" height="436"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="plain" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="13" outlineTableColumn="kMg-KD-jnr" id="Spv-Il-Vgj" customClass="KMOutlineView" customModule="PDF_Office" customModuleProvider="target">
+                            <outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="plain" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="13" outlineTableColumn="kMg-KD-jnr" id="Spv-Il-Vgj" customClass="KMOutlineView" customModule="PDF_Master" customModuleProvider="target">
                                 <rect key="frame" x="0.0" y="0.0" width="286" height="436"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <size key="intercellSpacing" width="17" height="0.0"/>

+ 3 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/KMAnnotationView/Views/KMAnnotationOutlineCellView.xib

@@ -1,12 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationOutlineCellView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationOutlineCellView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="contentImageHeightConstraint" destination="AH1-Kl-Chh" id="QjB-3j-uXs"/>
                 <outlet property="contentImageView" destination="doR-ts-Gag" id="cnp-pY-Lfl"/>