macOS: extract attributed string helper

This commit is contained in:
Peter Steinberger
2025-12-09 00:55:04 +01:00
parent 36c91c3984
commit 9928f1b3c1
2 changed files with 9 additions and 8 deletions

View File

@@ -0,0 +1,9 @@
import Foundation
extension NSAttributedString {
func strippingForegroundColor() -> NSAttributedString {
let mutable = NSMutableAttributedString(attributedString: self)
mutable.removeAttribute(.foregroundColor, range: NSRange(location: 0, length: mutable.length))
return mutable
}
}

View File

@@ -663,11 +663,3 @@ private final class TranscriptNSTextView: NSTextView {
super.keyDown(with: event)
}
}
private extension NSAttributedString {
func strippingForegroundColor() -> NSAttributedString {
let mutable = NSMutableAttributedString(attributedString: self)
mutable.removeAttribute(.foregroundColor, range: NSRange(location: 0, length: mutable.length))
return mutable
}
}