Browse Source

【综合】标记秘文透明色兼容

tangchao 4 months ago
parent
commit
d02a951a11

+ 3 - 3
PDF Office/PDF Master/Class/PDFTools/Redact/Window/KMRedactPropertiesWindowController.swift

@@ -57,9 +57,9 @@ class KMRedactPropertiesWindowController: NSWindowController {
         self.okButton.title = KMLocalizedString("OK", nil)
         
         if let anno = self.readactAnnotation {
-            self.outlineColorWell.color = anno.borderColor()
-            self.fillColorWell.color = anno.interiorColor()
-            self.fontColorWell.color = anno.fontColor()
+            self.outlineColorWell.color = anno.borderColor() ?? .red
+            self.fillColorWell.color = anno.interiorColor() ?? .clear
+            self.fontColorWell.color = anno.fontColor() ?? .red
             
             self.fontSizeComboBox.stringValue = String(format: "%.lf pt", anno.font().pointSize)
             var segment = 0

+ 6 - 6
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTableViewCell.swift

@@ -319,15 +319,15 @@ extension KMNoteTableViewCell {
 //                if(contentString.isEmpty == false) {
                     self.foldButton.isHidden = false
 //                }
-                let attributeStr = NSMutableAttributedString(string: contentString)
+                let attributeStr = NSMutableAttributedString(string: noteString)
                 if (markup.markupType() == .highlight) {
-                    attributeStr.addAttribute(.backgroundColor, value: noteColor as Any, range: NSMakeRange(0, contentString.count))
+                    attributeStr.addAttribute(.backgroundColor, value: noteColor as Any, range: NSMakeRange(0, attributeStr.length))
                 } else if (markup.markupType() == .strikeOut) {
-                    attributeStr.addAttribute(.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, contentString.count))
-                    attributeStr.addAttribute(.strikethroughColor, value: noteColor as Any, range: NSMakeRange(0, contentString.count))
+                    attributeStr.addAttribute(.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, attributeStr.length))
+                    attributeStr.addAttribute(.strikethroughColor, value: noteColor as Any, range: NSMakeRange(0, attributeStr.length))
                 } else if (markup.markupType() == .underline) {
-                    attributeStr.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, contentString.count))
-                    attributeStr.addAttribute(.underlineColor, value: noteColor as Any, range: NSMakeRange(0, contentString.count))
+                    attributeStr.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, attributeStr.length))
+                    attributeStr.addAttribute(.underlineColor, value: noteColor as Any, range: NSMakeRange(0, attributeStr.length))
                 }
                 self.annotationContentLabel.attributedStringValue = attributeStr