macOS: extract attributed string helper
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -663,11 +663,3 @@ private final class TranscriptNSTextView: NSTextView {
|
|||||||
super.keyDown(with: event)
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user